directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vinod Panicker <vino...@gmail.com>
Subject [mina] ByteBuffer problem?
Date Wed, 20 Apr 2005 05:25:55 GMT
Hi Trustin,

Here's the code that I was having a problem with - 

-- begin code --

public void decode(ProtocolSession session, ByteBuffer in,
ProtocolDecoderOutput out)
{
	ByteBuffer temp = ByteBuffer.allocate(in.capacity());
	temp.put(in);
	temp.flip().limit(in.limit());
	in.flip();
	System.out.println("[D] Data decoded : " + in.getHexDump());
	System.out.println("[D] Data decoded char : " + in.getString(in.limit(), 
		Charset.defaultCharset().newDecoder()));
	out.write(temp);
}

-- end code --

If you notice, I've made a copy of the ByteBuffer to be able to se
getHexDump() and getString() on it.  If I try to use just one
ByteBuffer variable, it simply doesnt work, even after flipping and
what not.  Any clues?

Regards,
Vinod.

Mime
View raw message