안드로이드 개발 질문/답변
(글 수 358)
BufferedWriter bufferW = new BufferedWriter(new OutputStreamWriter(ost));
BufferedReader bufferR = new BufferedReader(new InputStreamReader(ist));
ByteBuffer buf = ByteBuffer.allocate(HEADER_LENGTH + xml.length());
//NHGP Header
buf.put( PROTOCOL_VERSION.getBytes() ); //Protocol Version(8byte)
buf.putShort( SESSTION_ID ); //Session ID (2byte)
buf.put( MESSAGE_TYPE_REQUEST ); //Message Type (2byte)
buf.put( CONTROL_MESSAGEID_DATAMESSAGE); //Control Message Id (2byte)
buf.putInt( TRANSACTION_ID ); //Transaction Id (4byte)
buf.putShort( KEEPALIVETIMEOUT ); //KeepAliveTimeout (4byte)
buf.putShort(OK); //Error Code (2byte)
buf.putInt(0); //Reserved1 (4byte)
buf.putInt(0); //Reserved2 (4byte)
buf.putInt(xml.length()); //XML Data Length (4byte)
//NHGP Data
buf.put(xml.getBytes()); //XML Data (x byte)
buf.flip();
System.out.println("buf----" + buf);
bufferW.write(buf);
bufferW.flush();
BufferedWriter 에 write를 할때 ByteBuffer 하려고합니다.
bufferW.write(buf);이런식으로
그런대 int형만 값이들어간다해서 .gatint 해도 이상한값이 출력되더라구요
어떤식으로 보내야하는지 질문드립니다.