# HG changeset patch # User fuchita # Date 1194683414 -32400 # Node ID d1c6cb6d9a2fa4cb120c03ff25ee7eb02115082b # Parent 593f915dd6ff84752a36212feaf602920fd41ee3 UTF-8 TEST diff -r 593f915dd6ff -r d1c6cb6d9a2f test/TestUTF8.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/TestUTF8.java Sat Nov 10 17:30:14 2007 +0900 @@ -0,0 +1,132 @@ +//package rep; +package test; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.CharacterCodingException; +import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CharsetEncoder; + +import remoteeditor.command.REPCommand; +import remoteeditor.network.REP; + +//import remoteeditor.command.REPCommand; + +public class TestUTF8 { + + public static ByteBuffer pack(REPCommand command){ + //command.setString(command.string + ":temp:123456"); //あとで書き直す + System.out.println("send command: " + command.toString()); + ByteBuffer buffer = ByteBuffer.allocateDirect(24+(command.string).length()*2); + buffer.clear(); // position = 0 + buffer.putInt(command.cmd); buffer.putInt(command.sid); buffer.putInt(command.eid); + buffer.putInt(command.seq); buffer.putInt(command.lineno); + buffer.putInt(command.string.length()*2); + for(int i=0;i