1. What class would you use to read a few pieces of data that are at known positions near the end of a large file?
2. In a
format
call, what's the best way to indicate a new line?3. How would you append data to the end of a file? Show the constructor for the class you would use and explain your answer.
1. Implement a pair of classes, one
Reader
and oneWriter
, that count the number of times a particular character, such ase
, is read or written. The character can be specified when the stream is created. Write a program to test your classes. You can usexanadu.txt
as the input file.2. The file
datafile
begins with a singlelong
that tells you the offset of a single int piece of data within the same file. Using theRandomAccessFile
class, write a program that gets the int piece of data. What is theint
data?