Thanks a ton Trustin, once again. I am not supposed to modify the client code, but seems that this is the only way to do it, as stream has two ends , and one nedds to consider for both ends.
Thanks a lot !!! Regards, Yogs Trustin Lee wrote: > > Hi Yogs, > > On 4/5/07, Yogs <[EMAIL PROTECTED]> wrote: >> >> Hi >> >> I have prototype for latency measurements, in which I have a blocking >> stream >> based client and server based on MINA. When client sends handshake data, >> which is really a java object, I get a Byte buffer on the server but I >> don't >> how to extract a java object from that byte buffer. I tried using >> buffer.asInputStream() and buffer.getObject(), but both of them are not >> working for me , and throws Exceptions such as StreamCorruptedException >> and >> BufferUnderFlowException respectively. >> >> Do u have any idea what is the correct way to extract a java object from >> a >> MINA byte buffer? > > You will have to modify your client to write a Java object using > ObjectSerializationOutputStream and read using > ObjectSerializationInputStream instead of ObjectInput/OutputStream. > These stream classes are located in > org.apache.mina.filter.codec.serialization package. Object I/O > streams are designed to be suitable for blocking streams, so we > couldn't make it usable for non-blocking I/O. Objects written with > ObjectSerializationOutputStream also can be read via > ByteBuffer.getObject(). > > HTH, > Trustin > -- > what we call human nature is actually human habit > -- > http://gleamynode.net/ > -- > PGP Key ID: 0x0255ECA6 > > -- View this message in context: http://www.nabble.com/way-to-extract-a-java-object-from-a-MINA-byte-buffer--tf3530399.html#a9859012 Sent from the mina dev mailing list archive at Nabble.com.
