comparison rep/REPCommandPacker.java @ 295:6deb6de8d0eb

*** empty log message ***
author pin
date Mon, 29 Sep 2008 14:13:19 +0900
parents 5b7abc22e61a
children 7107faaf3feb
comparison
equal deleted inserted replaced
294:7a5798b7f10c 295:6deb6de8d0eb
35 35
36 /* (non-Javadoc) 36 /* (non-Javadoc)
37 * @see rep.REPPack#packUConv(rep.REPCommand) 37 * @see rep.REPPack#packUConv(rep.REPCommand)
38 */ 38 */
39 public ByteBuffer packUConv(REPCommand command){ 39 public ByteBuffer packUConv(REPCommand command){
40 System.out.println("send command byUTF8: " + command.toString()); 40 //System.out.println("send command byUTF8: " + command.toString());
41 if(command.string == null){ 41 if(command.string == null){
42 command.setString("test"); 42 command.setString("test");
43 } 43 }
44 ByteBuffer buffer = ByteBuffer.allocateDirect(HEADER_SIZE+(command.string.length()*CHAR_ORDER)); 44 ByteBuffer buffer = ByteBuffer.allocateDirect(HEADER_SIZE+(command.string.length()*CHAR_ORDER));
45 buffer.clear(); // position = 0 45 buffer.clear(); // position = 0
62 e.printStackTrace(); 62 e.printStackTrace();
63 } 63 }
64 64
65 //Encoded string length set 65 //Encoded string length set
66 int length = (buffer.position() -pos) -4; 66 int length = (buffer.position() -pos) -4;
67 System.out.println("UTF-8: Set REPComand textlen(Byte) : " + (buffer.position() - pos-4)); 67 //System.out.println("UTF-8: Set REPComand textlen(Byte) : " + (buffer.position() - pos-4));
68 if(length < 0) { 68 if(length < 0) {
69 length = 0; 69 length = 0;
70 } 70 }
71 buffer.putInt(pos, length); 71 buffer.putInt(pos, length);
72 72