On 5/28/10 1:27 PM, dan brownell wrote:
Hi all,
I started writing my own prefix string codec
factory, then realised there was one already.
MINA's version ?
But I'm having
trouble working how to encode the prefix. The client program
doesn't use Mina, so I'm doing this:
BufferedWriter wr = new
BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
String
myString = "Hello";
wr.write(myString.length());
wr.write(myString);
But this does not work. Meanwhile,
the PrefixedStringCodecFactory has a method,
setDecoderPrefixLength(prefixLength), and I'd assume that since I'm
sending an int, I'd want 4 bytes. I see in the source code that I need to do
whatever ByteBuffer's putInt does, but I'm not sure what that is.
Can you provide your decoder code ?
--
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com