On Jan 12, 2011, at 12:57 , Nader Salehi wrote:
I have a Java-base TCP server which needs some modification.  It has
to accept messages as CodedInputStream from C++ clients that send
CodedOutputStream.  The server uses NIO class
java.nio.channels.SocketChannel to read from the socket.  What would
be the easiest way to attach a CodedInputStream to this?

I created a really thin InputStream implementation that wrapped my NIO ByteBuffer(s), then use CodedInputStream.newInstance(InputStream stream). You really only need to implement the read(byte[] destination, int offset, int length) method of this class, so it is actually pretty straightforward. There might be a "better" way but it works for me. Hope this helps,


Evan Jones

You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to