Simple stream read/write question in java
Posted
by Marius
on Stack Overflow
See other posts from Stack Overflow
or by Marius
Published on 2010-03-19T13:04:19Z
Indexed on
2010/03/19
13:11 UTC
Read the original article
Hit count: 173
java
Hi,
I'm trying to upload a file via URLConnection, but i need to read/write it as a binary file without any encoding changes. So i've tried to read byte[] array from FileInputStream, but now i have an issue. The PrintWriter object i use for outputing to the server does not allow me to do writer.write(content) (where content is of type byte[]). How can i fix this? Or is there another way to quickly copy binary data from a FileInputStream to a PrintWriter?
Thank you
© Stack Overflow or respective owner