Bluetooth FTP 仕様では、ACTION 操作を使用する必要があると記載されています。ページは次のとおりです。
ただし、ClentSessionは GET および PUT 操作のみを提供し、Javadoc には何も記載されていません。
ファイルの作成操作は次のようになります。非常に簡単です。
public void create() throws IOException {
HeaderSet hs = cs.createHeaderSet();
hs.setHeader(HeaderSet.NAME, file);
op = cs.put(hs);
OutputStream os = op.openOutputStream();
os.close();
op.close();
}
質問 1: カスタム ヘッダーを使用して ACTION 操作を実装し、移動/名前変更およびアクセス許可の設定を実行するにはどうすればよいですか? JSR82 OBEX API がなくても可能です。これを行うのを手伝ってください。
質問 2: アクセス許可の設定方法は理解できましたか? OBEX_Errata Compiled For 1.3.pdf によると (alanjmcf に感謝!)
したがって、読み取り専用に設定するには、次の手順を実行する必要があります。
int a = 0;
//byte 0 //zero
//byte 1 //user
//byte 2 //group
//byte 3 //other
//set read for user
a |= (1 << 7); //8th bit - byte 1, bit 0 -> set to 1
// a = 10000000
//for group
a |= (1 << 15); //16th bit - byte 2, bit 0 -> set to 1
// a = 1000000010000000
//for other
a |= (1 << 23); //24th bit - byte 3, bit 0 -> set to 1
// a = 100000001000000010000000
//or simply
private static final int READ = 8421504 //1000,0000,1000,0000,1000,0000
int value = 0 | READ;
//========== calculate write constant =========
a = 0;
a |= (1 << 8); //write user
a |= (1 << 16); //write group
a |= (1 << 24); //write other
// a = 1000000010000000100000000
private static final int WRITE = 16843008 // 1,0000,0001,0000,0001,0000,0000
//========= calculate delete constant ==========
a = 0;
a |= (1 << 9); //delete user
a |= (1 << 17); //delete group
a |= (1 << 25); //delete other
//a = 10000000100000001000000000
private static final DELETE = 33686016; //10,0000,0010,0000,0010,0000,0000
//========= calculate modify constant ==========
a = 0;
a |= (1 << (7 + 7)); //modify user
a |= (1 << (15 + 7)); //modify group
a |= (1 << (23 + 7)); //modify other
//a = 1000000010000000100000000000000
private static final MODIFY = 1077952512; // 100,0000,0100,0000,0100,0000,0000,0000
// now, if i want to set read-write-delete-modify, I will do the following:
int rwdm = 0 | READ | WRITE | DELETE | MODIFY;
// and put the value to the header... am I right?
正しい場合、唯一の問題は質問 1 のままです。ACTION 操作を行う方法とヘッダーを設定する方法です。