CH15_Files

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

With a _____, many "logical" chunks of data from a file are read as one large physical input operation into a memory buffer. This procedure is sometimes referred to as a logical input operation.

BufferedInputStream

_____ is an I/O-performance-enhancement technique.

Buffering

_____ output and input data in its binary format—a char is two bytes, an int is four bytes, a double is eight bytes, etc.

Byte-based streams

_____ output and input data as a sequence of characters in which every character is two bytes—the number of bytes for a given value depends on the number of characters in that value.

Character-based streams

_____ interface—Objects of classes that implement this interface enable a program to iterate through the contents of a directory.

DirectoryStream

Method readObject throws an _____ if an attempt is made to read beyond the end of the file.

EOFException

True/False: The data in many sequential files can be modified without the risk of destroying other data in the file.

False

A _____ occurs if the file does not exist and a new file cannot be created.

FileNotFoundException

_____ class—Provides static methods for common file and directory manipulations, such as copying files; creating and deleting files and directories; getting information about files and directories; reading the contents of files; getting objects that allow you to manipulate the contents of files and directories; and more.

Files

Class _____ enables formatted data to be output to any text-based stream in a manner similar to method System.out.printf.

Formatter

A _____ occurs if the Formatter is closed when you attempt to output.

FormatterClosedException

Class _____ displays a dialog that enables the user to easily select files or directories.

JFileChooser

A _____ occurs if the data being read by a Scanner method is in the wrong format or if there is no more data to input.

NoSuchElementException

To use serialization with files, initialize _____ and _____ objects that read from and write to files.

ObjectInputStream, ObjectOutputStream

_____ interface—Objects of classes that implement this interface represent the location of a file or directory. Objects of this interface do not open files or provide any file-processing capabilities.

Path

_____ class—Provides static methods used to get a Path object representing a file or directory location.

Paths

Class _____ is used extensively to input data from the keyboard. This class can also read data from a file.

Scanner

A _____ occurs if the user does not have permission to write data to the file.

SecurityException

Static method _____ terminates an application. An argument of 0 indicates successful program termination. A nonzero value, normally indicates that an error has occurred.

System.exit

Explain some classes: BufferedReader, BufferedWriter, CharArrayReader, CharArrayWriter, LineNumberReader, InputStreamReader, OutputStreamWriter, PipedReader, PipedWriter, StringReader, StringWriter, and PrintWriter

There is no definition for this question. Located on last few slides of ch15_jhtp10_TC_YC slide deck.

True/False: Java imposes no structure on a file

True

When using a Formatter, if the specified file already exists, its contents will be _____. If a file does not exist _____.

Truncated, it will be created

A _____ is a more general form of the Uniform Resource Locators (URLs) that are used to locate websites. On Windows platforms, an example looks like the following: file://C:/data.txt

Uniform Resource Identifier (URI)

Files created using byte-based streams are referred to as _____ files.

binary

Formatter method _____ closes the file. If the method is not called explicitly, the operating system normally will close the file when program execution terminates.

close

After a serialized object has been written into a file, it can be read from the file and _____ to recreate the object in memory.

deserialized

Every operating system provides a mechanism to determine the end of a file, such as an _____ a count of the total bytes in the file that is recorded in a system-maintained administrative data structure.

end-of-file marker

A partially filled buffer can be forced out to the device at any time by invoking the stream object's _____ method.

flush

Formatter method _____ works like System.out.printf.

format

A Java program _____ a file by creating an object and associating a stream of bytes or characters with it.

opens

Class System provides methods setIn, setOutandsetErr to _____ the standard input, output and error streams, respectively.

redirect

To read an entire object from or write an entire object to a file, Java provides object _____.

serialization

A _____ is represented as a sequence of bytes that includes the object's data and its type information.

serialized object

Call method _____ specifies what the user can select from the fileChooser. For this program, we use JFileChooser static constant FILES_AND_DIRECTORIES to indicate that files and directories can be selected. Other static constants include FILES_ONLY(the default) and DIRECTORIES_ONLY.

setFileSelectionMode

Java views each file as a sequential _____.

stream of bytes

Interface Serializable is a _____ interface. It does not contain methods.

tagging

Files created using character-based streams are referred to as _____ files.

text

In a class that implements Serializable, every variable must be Serializable. Any one that is not must be declared _____ so it will be ignored during the serialization process.

transient

ObjectOutputinterface method _____ takes an Object as an argument and writes its information to an OutputStream. ObjectInputinterface method _____ reads and returns a reference to an Object from an InputStream.

writeObject, readObject


Ensembles d'études connexes

3614 Alterations in Bowel Elimination

View Set

Ch 54, CH37-COMMUNITY AND ECOSYSTEM ECOLOGY, Chapter 37, 1041SCG Biological Systems Week 12, Ecology CH. 12 Book Online Question, quiz 5, Chapter 38, Biology Ch. 42 and 43, Ecology Exam, BSC2011L Chapter 53 Q A, Chapter 53 practice test, Biology Fina...

View Set

Unit 4 quiz Business and Technology

View Set

HIPAA: Privacy Compliance True or False

View Set

1.4 Gravity: A Force of Attraction

View Set

Malk Partners -- 2nd Round Interview

View Set

[nature News] 9. Biomedical research is becoming more open about its funding and data

View Set