You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Johannes U. Jensen" <sp...@daimi.au.dk> on 2006/05/25 16:03:18 UTC

ByteBuffer.getString

Hi,

I just started using MINA and noticed that you cannot just extract a 
string from a bytebuffer if it contains a null. It is possible to get a 
string with a maximum number of characters but I need an absolute number 
of characters even if it contains a null. It seems like a strange 
requirement to me that it has to end in null but are there any easy ways 
to ignore this or would it be easier to implement my own method?

Regards
Johannes

Re: ByteBuffer.getString

Posted by peter royal <pr...@apache.org>.
On May 25, 2006, at 10:03 AM, Johannes U. Jensen wrote:
> I just started using MINA and noticed that you cannot just extract  
> a string from a bytebuffer if it contains a null. It is possible to  
> get a string with a maximum number of characters but I need an  
> absolute number of characters even if it contains a null. It seems  
> like a strange requirement to me that it has to end in null but are  
> there any easy ways to ignore this or would it be easier to  
> implement my own method?

I think ByteBuffer.get/setPrefixedString might work in your situation?
-pete

-- 
proyal@apache.org - http://fotap.org/~osi