On Oct 18, 7:18 pm, Arne Vajh?j <a...@vajhoej.dk> wrote:
> PS: Don't your web service toolkit decode automatically ??
Actually, it was! I've gotten around the whole encoding/decoding
issue, but for some reason it's not writing the bytes out correctly.
I'm using an ObjectOutputStream to write to a FileOutputStream. The
problem is there is extra data at the begining of the file. Not sure
why. Nothing is prepending the array with extra data... Is there
something better than ObjectOutputStream to write an array of bytes?
Gordon Beaton - 19 Oct 2007 18:39 GMT
> Actually, it was! I've gotten around the whole encoding/decoding
> issue, but for some reason it's not writing the bytes out correctly.
> I'm using an ObjectOutputStream to write to a FileOutputStream.
If you've got an array of bytes that you want to write verbatim to the
file, then you should use the write methods provided by the
FileOutputStream itself. Don't wrap it in any kind of Writer, and
certainly not an ObjectOutputStream.
/gordon
--
Christian - 19 Oct 2007 18:43 GMT
lord.zoltar@gmail.com schrieb:
>> PS: Don't your web service toolkit decode automatically ??
>
[quoted text clipped - 4 lines]
> why. Nothing is prepending the array with extra data... Is there
> something better than ObjectOutputStream to write an array of bytes?
The Object Output Stream itself writes these bytes..
just use the FileOutputStream ... it has exactly the method you need..
void write(byte[] b)
Roedy Green - 21 Oct 2007 08:08 GMT
>The Object Output Stream itself writes these bytes..
>just use the FileOutputStream ... it has exactly the method you need..
>void write(byte[] b)
The whole point of base64 is to make sure all bytes are "printable".
If you write them out with an ObjectOutputStream you will sandwich
them in some unprintable binary housekeeping.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Roedy Green - 21 Oct 2007 08:07 GMT
>I'm using an ObjectOutputStream to write to a FileOutputStream. The
>problem is there is extra data at the begining of the file.
I suspect you don't know what ObjectOutputStream is. It is
serialisation format . See
http://mindprod.com/jgloss/serialization.html
Anything for base64 would more likely go through
DataOutPutStream to a ByteArrayStream, converted to Base64 encoded
bytes then sent out with a plain OutputStream.
Since Base64 is not supported as one of the standard encodings, you
can't put it together into a unified outputstream.
see http://mindprod.com/jgloss/base64.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com