Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to implement ACTION (move/rename, set permissions) operation in J2ME Bluetooth OBEX?
    primarykey
    data
    text
    <p>Bluetooth FTP specification says I need to use ACTION operation, here's a page <a href="http://i47.tinypic.com/2425t2v.png" rel="nofollow noreferrer">http://i47.tinypic.com/2425t2v.png</a></p> <p>But the <a href="http://library.developer.nokia.com/index.jsp?topic=/Java_Developers_Library/GUID-9F75713D-5642-4C39-9A33-C20928F37BF7/javax/obex/ClientSession.html" rel="nofollow noreferrer">ClentSession</a> provides only GET and PUT operations, and nothing mentioned in javadocs.</p> <p>here's how the create file operation looks, it's pretty easy</p> <pre><code> 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(); } </code></pre> <p>Question 1: How do I implement ACTION operation with custom headers to perform move/rename and set permissions? It should be possible without JSR82 OBEX API. Please help me to do this.</p> <p>Question 2: Did I understand how to set permissions? According to OBEX_Errata Compiled For 1.3.pdf (thanks alanjmcf!)</p> <p><a href="http://i45.tinypic.com/2h84led.jpg" rel="nofollow noreferrer">1 http://i45.tinypic.com/2h84led.jpg</a></p> <p><a href="http://i49.tinypic.com/2wgysmx.png" rel="nofollow noreferrer">2 http://i49.tinypic.com/2wgysmx.png</a></p> <p>So, to set read-only, I should do the following:</p> <pre><code> int a = 0; //byte 0 //zero //byte 1 //user //byte 2 //group //byte 3 //other //set read for user a |= (1 &lt;&lt; 7); //8th bit - byte 1, bit 0 -&gt; set to 1 // a = 10000000 //for group a |= (1 &lt;&lt; 15); //16th bit - byte 2, bit 0 -&gt; set to 1 // a = 1000000010000000 //for other a |= (1 &lt;&lt; 23); //24th bit - byte 3, bit 0 -&gt; 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 &lt;&lt; 8); //write user a |= (1 &lt;&lt; 16); //write group a |= (1 &lt;&lt; 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 &lt;&lt; 9); //delete user a |= (1 &lt;&lt; 17); //delete group a |= (1 &lt;&lt; 25); //delete other //a = 10000000100000001000000000 private static final DELETE = 33686016; //10,0000,0010,0000,0010,0000,0000 //========= calculate modify constant ========== a = 0; a |= (1 &lt;&lt; (7 + 7)); //modify user a |= (1 &lt;&lt; (15 + 7)); //modify group a |= (1 &lt;&lt; (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? </code></pre> <p>if right, the only problem remains the question 1: how do I make ACTION operation and how to set the headers.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload