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 later.


On Dec 2, 10:46 pm, Jason Hsueh <jas...@google.com> wrote:
>
> Well, InputStream and OutputStream are abstract classes. I'm not sure how
> you instantiated them in your tests to determine that they do not work
> (unless the problem you got was that you could not create an abstract
> OutputStream object, which has nothing to do with protobuf code). You need
> to provide a concrete implementation of OutputStream. writeTo() only cares
> about writing raw bytes to the OutputStream, so the additional methods like
> writeInt() and writeObject() provided by DataOutputStream and
> ObjectOutputStream, respectively, do not matter. The only thing that would
> matter is if the bytes that were passed to the write() method were not the
> actual bytes written. As Kenton pointed out this is the case for, say, a
> gzipped output stream. You would obviously need to have your reader be aware
> that it is reading gzipped data, rather than raw bytes. Otherwise, it
> doesn't matter what output stream implementation you choose, so long as it
> writes the bytes that are passed to the write() method.
>
> If message.writeTo(socket.getOutputStream()); does not work for you, please
> post a small reproducible example.
>
>
>
> > I keep coming around to the fact that it looks like a specific data
> > stream type in Java does do something to the byte stream (perhaps
> > adding extra bytes for a header or some sort of meta information like
> > you mentioned?  And in Java you might need the same input stream to
> > read it properly? I dunno -but again from my original post, I want to
> > make sure if I do get that series of bytes over to a C++ app, it's in
> > a form that can be handled.).
> > Anyway, I'm going to experiment further to see what I get.  If I get a
> > simple example working, I'll post it as I'm sure I can't be the first
> > person with this dilemma.
>
> > On Dec 2, 6:31 pm, Henner Zeller <henner.zel...@googlemail.com> wrote:
> > > Hi,
>
> > > transparent as in: the same data is written out that you put in. If
> > > you see a difference then this might be because the ObjectOutputStream
> > > might add something to the data you provide, such as writing
> > > delimiters or something. So I guess the simple write(byte[]) will not
> > > actually write the content of the arrays but as well the length or
> > > something (this is a wild guess - haven't looked at the sources, but
> > > it would explain what you see).
>
> > > Why do you use the ObjectOutputStream anyway instead of the simpler
> > > OutputStream ?
>
> > --
>
> > 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
> > protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/protobuf?hl=en.
>
>

--

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 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.


Reply via email to