aspose file tools
The moose likes Beginning Java and the fly likes InputStream into byte array Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "InputStream into byte array" Watch "InputStream into byte array" New topic
Author

InputStream into byte array

Dean Reedy
Ranch Hand

Joined: Sep 10, 2001
Posts: 89
I need to read a text file into a byte array. How could I do this.
For example I have a byte array called buffer, I have opened a InputStream "is" and I am reading it in one byte at a time. Now how do I append or add the int "c" into the byte array called "buffer"? Any better ideas would be great.
byte [] buffer;
int c;
while ( c = is.read() != -1 )) {
???
}
thanks,
Dean
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: InputStream into byte array
 
Similar Threads
inputstream to bytebuffer
Reading byteArray at Client side
Showing output from Runtime.getRuntime().exec
Why does this truncate my files?
Streaming out data using ServletOutputStream