If I load a binary file, would that file display only 1's and 0's, no matter what kind of file I load(image, text file, jpg, etc)? When I load a file as a binary file, which read method should I use? At the moment I'm using readByte, but I'm not sure if thats the right one to use. Thanks in advance.
Joined: Mar 05, 2002
A binary file means that it is not a file that can be (simply) read by looking at the contents.
It means that it is formatted in such a way that is specific for a computer (program) to understand it.
It does not mean that if you open it in a simple texteditor that it contains only one's and zero's. Remember, 8 bits is 1 byte. This means that the texteditor will show you the characters that represent the byte.
You can read a binary file with whatever method you would like. InputStreams deal with bytes however. So if you want to printout the binary content of a file you will have to translate the byte to a binary number. eg. byte value = 4 --> binary value = 0100 [ September 08, 2006: Message edited by: Manuel Moons ]