This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "InputStream into byte array" Watch "InputStream into byte array" New topic

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 = != -1 )) {
I agree. Here's the link:
subject: InputStream into byte array
It's not a secret anymore!