|
NOTA: La traducción de esta documentación es un esfuerzo personal y voluntario, no es un documento oficial de Sun Microsystems
ni Oracle ni está patrocinado por ninguna de estas empresas. Los documentos originales (en inglés) están disponibles en:
http://java.sun.com/docs/books/tutorial/.
Dirija cualquier comentario, petición, felicitación, etc. a tutorialesjava_@RROBA_codexion.com. |
Si desea ayudar a mantener en funcionamiento esta web, colaborar con la traducción de estos documentos o necesita que se traduzca algĂșn capĂtulo en concreto puede realizar una donación directa mediante Paypal:
|
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
formatcall, 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
Readerand 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.txtas the input file.2. The file
datafilebegins with a singlelongthat tells you the offset of a singleintpiece of data within the same file. Using theRandomAccessFileclass, write a program that gets theintpiece of data. What is theintdata?