Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes InputStream into byte array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
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
Streaming out data using ServletOutputStream
Why does this truncate my files?
Showing output from Runtime.getRuntime().exec
Reading byteArray at Client side
inputstream to bytebuffer