06 File Input and Output Flashcards

1
Q

It returns the String representation of the Path, eliminating double backslashes.

A

String toString()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Exception that is thrown if there is an attempt to delete a file without permission.

A

SecurityException

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the common characteristics of a text file and binary file?

A

Size
Name
Date
Time of creation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

It depends on other path information.

A

relative path

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Is a collection of fields that contain data about an entity. It is grouped to create files.

A

record

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Method that writes a single character.

A

write(int c)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Method that skips the specified number of characters.

A

skip(long n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Storage that is permanent. It is saved on a disk.

A

Non-volatile Storage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Method that flushes the stream.

A

flush()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

It is a complete path; it does not require any other information to locate a file on a system.

A

absolute path

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

It returns the name in position of the Path specified by the integer parameter.

A

Path getName(int)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When each record in a file is accessed one after another in the order in which it was stored, the data file is used as a ________ .

A

sequential access file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Method that can be used to remove a file without encountering an exception if the file does not exist.

A

deleteIfExists()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

It is being used when a Java program stores a value in a variable.

A

Random Access Memory (RAM)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Exception that is thrown if there is an attempt to delete a directory that has files.

A

DirectoryNotEmptyException

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the Path methods? (4)

A

String toString()
Path getFileName()
int getNameCount()
Path getName(int)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Exception that is thrown if there is an attempt to delete a file that does not exist.

A

NoSuchFileException

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

It is a memory location into which you can write data, which you can read again later.

A

buffer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

It performs operations on files and directories , such as determining their attributes, creating input and output streams, and deleting them.

A

Files class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Argument that opens the file if it exists or creates a new file if it hasn’t existed yet.

A

CREATE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What two (2) arguments that the readAttributes() method take?

A

Path object and BasicFileAttributes.class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What are the IO Classes? (10)

A

InputStream
FileInputStream
BufferedInputStream
OutputStream
FileOutputStream
BufferedOutputStream
PrintStream
Reader
BufferedReader
BufferedWriter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

It is the flow of data.

A

stream

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

It is the smallest useful piece of data.

A

character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
It is a method that returns the size o the file in bytes.
size()
26
What are the common methods of the OutputStream Class? (4)
void close() void flush() void write(byte[] b) void write(byte[] b, int off, int len)
27
It creates objects that contain information about files and directories, such as sizes, locations, creation dates, and is used to check whether a file or directory exists.
Path class
28
Method that is used to convert a relative path to an absolute path.
toAbsolutePath()
29
Is a group of character that has some meaning. It is group together to form records.
field
30
A record's fields cannot be organized into a single line or can be separated by a character. True or False?
False
31
Argument that opens the file for writing.
WRITE
32
What are the methods of the BufferedReader Class?
close() read() read(char[] buffer, int off, int len) readLine() skip(long n)
33
Method that is used to create a writable file.
newOutputStream()
34
A type of stream where data data is taken from a source and is delivered into a program.
input stream
35
Method used to verify if a file exists and if a program can access it when needed.
checkAccess()
36
Argument that checks whether the file exists and whether the program has permission to execute the file.
EXECUTE
37
Method that reads a single character.
read()
38
Argument that appends new data to the end of the file.
APPEND
39
Flushes the output stream; if any bytes are buffered, they will be written.
void flush()
40
It returns the file or directory denoted by this Path; this is the last item in the sequence of name elements.
Path getFileName()
41
What are the methods of the BufferedWriter?
close() flush() newline() write(String s, int off, int len) write(char[] array, int off, int len) write(int c)
42
Method that writes a character array from position off for length len.
write(char[] array, int off, int len)
43
It is a method that returns the date and time the file was last edited.
lastModifiedTime()
44
Handles input from a system's standard or default input device.
BufferedInputStream
45
Values in a record that are separated by commas are called?
comma-separated values
46
What the two (2) types of storage devices?
Volatile storage and Non-volatile storage
47
Method that writes a String from position off for length len.
write(String s, int off, int len)
48
Arguments passed in the newOutputStream are Path and StandardOpenOption. True or False?
True
49
Method that reads a line of text.
readLine()
50
Writes all bytes to the output stream from the specified byte array.
void write(byte[] b)
51
Is the format for creation time mm-dd-yyyyThh:mm:ss? True or False?
False. The format is: yyyy-mm-ddThh:mm:ss
52
Method that closes the stream, flushing it first.
close()
53
Contains methods for performing output that never throws an exception.
PrintStream
54
Abstract class that contains method for performing output.
OutputStream
55
It compares the relationship between values retrieved from creationTime() or lastModifiedTime().
compareTo()
56
It consists of data that can be read in a text editor.
Text file
57
What are the arguments of the checkAccess() method? (4)
None READ WRITE EXECUTE
58
What is the import used to use both the Path and Files class?
import java.nio.file.*;
59
Abstract class for reading character streams.
Reader
60
Permanent files are commonly stored in the home directory. True or False?
False. It is commonly stored in the main directory and root directory.
61
Writes text to a character-output stream, buffering characters to provide for efficient writing of characters, arrays, and lines.
BufferedWriter
62
Method used to retrieve useful information about a file.
readAttributes()
63
Abstract class that contains method for performing input.
InputStream
64
The complete list of the disk drive plus the hierarchy of directories in which the file is located is called ______ .
path
65
Closes the output stream and releases any system resources associated with the stream.
void close()
66
Argument that checks whether the file exists and whether the program has permission to read the file.
READ
67
Argument that creates a new file only if it hasn't existed yet; it throws an exception if the file already exists.
CREATE_NEW
68
Writes bytes to the output stream form the specified byte array starting at offset position off for a length of len characters.
void write(byte[] b, int off, int len)
69
What are the two (2) categories of a file?
Text file and binary file
70
It contains data that is not encoded as text.
Binary file
71
Argument that checks whether the file exists.
None
72
Method of the Files class that is used to open a file for reading.
newInputStream()
73
Provides the capability to read disk from files
FileInputStream
74
Method of the Files class that accepts a Path parameter and removes the last element in a path or throws an exception if unsuccessful.
delete()
75
Argument that deletes the file when the stream is closed; mostly used for temporary files that exist only for the duration of the program.
DELETE_ON_CLOSE
76
It returns the number of name elements in the Path
int getNameCount()
77
It consists of related records.
file
78
Method that reads characters into a portion of a array rom position off for len characters.
read(char[] buffer, int off, int len)
79
It is a method that returns the date and time the file was created.
creationTime()
80
It clears any bytes that have been sent to a buffer for output but have not yet been displayed on a hardware device.
flushing
81
It is a collection of data stored on a non-volatile device.
Computer File
82
What are the arguments of the StandardOpenOption?
WRITE APPEND TRUNCATE_EXISTING CREATE_NEW CREATE DELETE_ON_CLOSE
83
Storage that is temporary. Values are lost when the computer loses its power.
Volatile Storage
84
Method that writes a line separator.
newline()
85
Argument that truncates the existing file to 0 yte so the file contents are replaced.
TRUNCATE_EXISTING
86
It is a special character used to separate path components.
(\) path delimiter
87
The readAttributes() method returns an instance of the BasicFileAttributes.class. True or False?
True
88
Method that closes the stream and any resources associated with it.
close()
89
Provides the capability to write to disk files.
FileOutputStream
90
Reads text from a character-input stream, buffering characters to provide efficient reading of characters, arrays, and lines.
BufferedReader
91
Handles input form a system's standard or default output device.
BufferedOutputStream
92
Argument that checks whether the file exists and whether the program has permission to write to the file.
WRITE
93
A type of stream where data is delivered from a program to a destination.
output stream
94
What are the methods of the BasicFileAttributes?
size() creationTime() lastModifiedTime() compareTo()