Could a byte read from a file by readUnsignedByte()
be written to another file by writeByte()
.
Yes. Both methods use the same part of an int
for
their data.
The next example program is a file copy program. This program does byte-oriented I/O and will work with any file. The program is invoked from the command line, like this:
C:\Programs > java copyBytes sourceFile to destinationFile
The "to" argument is there to remind the user of the correct order for the file names. The program reads the original file one byte at a time and writes to the destination file one byte at a time.
What two stream classes are likely to be useful?