Reading a file into a byte array?
- From: "nooneinparticular314159@xxxxxxxxx" <nooneinparticular314159@xxxxxxxxx>
- Date: 31 Oct 2005 16:40:08 -0800
I need to read binary data of arbitrary length into a program,
manipulate the data, and then write the data to the network or to
another file. I know of two objects that might store this data:
byte[] (a byte array)
and
ByteArrayInputStream (which must be initialized with a byte[])
Now, the question is how do I get my data into byte[] in the first
place? I know how to read strings in:
public int ReadingMethod(String pathname) {
try {
BufferedReader reader = new BufferedReader(new
FileReader(pathname));
String readstring = new String();
while ((readstring = reader.readLine()) != null) {
etc.
But I don't know how to handle arbitrary binary data. Any thoughts on
how I can do this?
Thanks!
.
- Follow-Ups:
- Re: Reading a file into a byte array?
- From: Lothar Kimmeringer
- Re: Reading a file into a byte array?
- From: Roedy Green
- Re: Reading a file into a byte array?
- From: Roedy Green
- Re: Reading a file into a byte array?
- From: Thomas Fritsch
- Re: Reading a file into a byte array?
- Prev by Date: Re: network is hindering my applet
- Next by Date: Re: Reading a file into a byte array?
- Previous by thread: Re: recommendations or a java development environment
- Next by thread: Re: Reading a file into a byte array?
- Index(es):
Relevant Pages
|
Loading