Nigel Pickard wrote:
Here's my sample code. In this code, everything works for me -however
when I change the GPBClient to use Data IO streams (just comment out
the Object IO references and uncomment the Data IO references in
GPBClient), that's when I get the
Oliver:
thanks for the reply. I'm not going to use Object IO streams, rather
I used it as an example of how the IO stream type seems to make a
difference at each end. Further, I now realize that once I use an IO
stream type, I must use the same type of stream at each ends of a Java
app I
Anyway, for anyone else wanting to use ByteArrayStream in Java for
writing a Google , here is some code I've used:
ServerSocket serverSocket = new ServerSocket(2004, 10);
Socket socket = serverSocket.accept();
OutputStream outputStream = socket.getOutputStream();
outputStream.flush();
Jason:
You know that's what I thought too about the InputStream/OutputStream
after reading the Javadoc. I'm using Eclipse Galileo with Java
1.6.0.17 -for some reason it let me compile it and run it, creating an
instance -I figured that was probably one of the problems.
I'll post some code
Here's my sample code. In this code, everything works for me -however
when I change the GPBClient to use Data IO streams (just comment out
the Object IO references and uncomment the Data IO references in
GPBClient), that's when I get the
com.google.protobuf.InvalidProtocolBufferException:
Thanks for the reply Adam -I did a simple sub into my code with your
suggestion, but it doesn't work. However, now it's made me think of
more questions.
If protocol buffers doesn't use object I/O streams, which streams does
it use? The argument in Java simply asks for an OutputStream
Well ok, using gzip streams would obviously give you something different
(the bytes would come out gzipped). But none of the stream types you listed
make a difference.
On Wed, Dec 2, 2009 at 12:25 PM, Kenton Varda ken...@google.com wrote:
It doesn't matter what kind of stream you use.
If protocol buffers doesn't use object I/O streams, which streams does
it use? The argument in Java simply asks for an OutputStream
argument, and of course that could mean File, ByteArray, Object, Data,
etc
I mean that it only depends on the methods in OutputStream. You can
provide
Jason -do you mean any Java output stream type will work (as all Java
IO stream types ultimately use bytes), and that the byte stream
produced will have the bytes put in an accepted standard order by the
writeTo method? In other words, using the writeTo method for *any*
Java output stream type
Aaaah I think the fog is lifting. thanks!
So am I correct in thinking that byte order is taken in to account by
the GPB writeTo and parseFrom methods, no matter whether it's Java, C+
+, etc?
On Dec 2, 3:25 pm, Kenton Varda ken...@google.com wrote:
It doesn't matter what kind of stream you
On Wed, Dec 2, 2009 at 12:31, Nigel Pickard pickard.ni...@gmail.com wrote:
Jason -do you mean any Java output stream type will work (as all Java
IO stream types ultimately use bytes), and that the byte stream
produced will have the bytes put in an accepted standard order by the
writeTo method?
Adam, Jason, Kenton and Henner, thanks and much appreciated!
--
You received this message because you are subscribed to the Google Groups
Protocol Buffers group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to
Oh, wait So I have a test Java app where one thread is running as
a server, one as a client.
I've been sending a GPB defined class instance between them, no
problem when I use Object I/O streams (e.g. ObjectOutputStream on the
server, ObjectInputStream on the client. I've been calling
Are your ObjectOutputStreams transparent ? Or do they prepend/append
things to the data ?
On Wed, Dec 2, 2009 at 13:11, Nigel Pickard pickard.ni...@gmail.com wrote:
Oh, wait So I have a test Java app where one thread is running as
a server, one as a client.
I've been sending a GPB defined
Henner:
I'm not sure what you mean by the datastream being transparent, but
basically I'm sending a GPB instance from the server to the client.
Initially I used ObjectOutputStream on the server, ObjectInputStream
on the client. I then changed the client to use DataInputStream
(apologies, my
Hi,
On Wed, Dec 2, 2009 at 15:21, Nigel Pickard pickard.ni...@gmail.com wrote:
Henner:
I'm not sure what you mean by the datastream being transparent, but
basically I'm sending a GPB instance from the server to the client.
Initially I used ObjectOutputStream on the server, ObjectInputStream
There is no reason to use ObjectInputStream/ObjectOutputStream with protocol
buffers.
On Wed, Dec 2, 2009 at 4:15 PM, Nigel Pickard pickard.ni...@gmail.comwrote:
When the Java test app works, I'd say the IO stream is transparent. I
use the same simple object instance each time (have a hard
On Wed, Dec 2, 2009 at 4:15 PM, Nigel Pickard pickard.ni...@gmail.comwrote:
When the Java test app works, I'd say the IO stream is transparent. I
use the same simple object instance each time (have a hard coded
method that simply returns the same object so it's identical), and I
simply call
18 matches
Mail list logo