Chapter 19


Chapter 18

1. 

What is the purpose of the File class? Can the File class be used to create an actual file? If so, how?

image from book

2. 

What are the primary differences between the byte-stream classes and the character-stream classes?

image from book

3. 

What is meant by the term data sink? What is meant by the term data source?

image from book

4. 

What’s the purpose of any java.io class that contains the word Buffer in its name? What is the default buffer size for any such class?

image from book

5. 

In your own words describe what is meant by the terms file terminal class, intermediate class, and user fronting class.

image from book

6. 

(True/False) The RandomAccessFile class can be used to write serializable objects to a file.

image from book

7. 

What combination of classes can be used to write and read serializable objects to and from a file?

 - fileoutputstream, bufferedoutputstream, objectoutputstream

8. 

What classes can be used to write textual representations of primitive types and objects to a file?

 - printwriter, printstream

9. 

What interface must an object implement before it can be serialized to a file?

image from book

10. 

What classes in the java.io package implement the DataInput or DataOutput interface?

 - datainputstream, dataoutputstream

Answers

1. 

- The File class represents the name of a file or directory. Yes, the File class can be used to create empty files and directories using the appropriate methods.

2. 

- Character stream class should be favored when manipulating large amounts of character data and you need to control character encoding.

3. 

- A sink is a destination to which data is being sent to; a source is an origination point from which data is being read.

4. 

- Improves the efficiency of reads and writes by caching data and writing or reading when the buffer is flushed.

5. 

- a file terminal class is a java.io class that takes the name of the file as an argument to its constructor; An intermediate class is one that is used in conjunction with a file-terminal class to provide augmented functionality but does not possess sufficient user interface methods to make it a user-fronting class; User-fronting classes provide numerous user interface methods.

6. 

- false

7. 

- FileOutputStream, BufferedOutputStream, ObjectOutputStream

8. 

- PrintWriter, PrintStream

9. 

- Serializable

10. 

- DataInputStream, DataOutputStream




Java For Artists(c) The Art, Philosophy, and Science of Object-Oriented Programming
Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504052
EAN: 2147483647
Year: 2007
Pages: 452

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net