06 File Input and Output Flashcards
It returns the String representation of the Path, eliminating double backslashes.
String toString()
Exception that is thrown if there is an attempt to delete a file without permission.
SecurityException
What are the common characteristics of a text file and binary file?
Size
Name
Date
Time of creation
It depends on other path information.
relative path
Is a collection of fields that contain data about an entity. It is grouped to create files.
record
Method that writes a single character.
write(int c)
Method that skips the specified number of characters.
skip(long n)
Storage that is permanent. It is saved on a disk.
Non-volatile Storage
Method that flushes the stream.
flush()
It is a complete path; it does not require any other information to locate a file on a system.
absolute path
It returns the name in position of the Path specified by the integer parameter.
Path getName(int)
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 ________ .
sequential access file
Method that can be used to remove a file without encountering an exception if the file does not exist.
deleteIfExists()
It is being used when a Java program stores a value in a variable.
Random Access Memory (RAM)
Exception that is thrown if there is an attempt to delete a directory that has files.
DirectoryNotEmptyException
What are the Path methods? (4)
String toString()
Path getFileName()
int getNameCount()
Path getName(int)
Exception that is thrown if there is an attempt to delete a file that does not exist.
NoSuchFileException
It is a memory location into which you can write data, which you can read again later.
buffer
It performs operations on files and directories , such as determining their attributes, creating input and output streams, and deleting them.
Files class
Argument that opens the file if it exists or creates a new file if it hasn’t existed yet.
CREATE
What two (2) arguments that the readAttributes() method take?
Path object and BasicFileAttributes.class
What are the IO Classes? (10)
InputStream
FileInputStream
BufferedInputStream
OutputStream
FileOutputStream
BufferedOutputStream
PrintStream
Reader
BufferedReader
BufferedWriter
It is the flow of data.
stream
It is the smallest useful piece of data.
character
It is a method that returns the size o the file in bytes.
size()
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)
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
Method that is used to convert a relative path to an absolute path.
toAbsolutePath()
Is a group of character that has some meaning. It is group together to form records.
field
A record’s fields cannot be organized into a single line or can be separated by a character. True or False?
False
Argument that opens the file for writing.
WRITE
What are the methods of the BufferedReader Class?
close()
read()
read(char[] buffer, int off, int len)
readLine()
skip(long n)
Method that is used to create a writable file.
newOutputStream()
A type of stream where data data is taken from a source and is delivered into a program.
input stream
Method used to verify if a file exists and if a program can access it when needed.
checkAccess()
Argument that checks whether the file exists and whether the program has permission to execute the file.
EXECUTE
Method that reads a single character.
read()
Argument that appends new data to the end of the file.
APPEND
Flushes the output stream; if any bytes are buffered, they will be written.
void flush()
It returns the file or directory denoted by this Path; this is the last item in the sequence of name elements.
Path getFileName()
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)
Method that writes a character array from position off for length len.
write(char[] array, int off, int len)
It is a method that returns the date and time the file was last edited.
lastModifiedTime()
Handles input from a system’s standard or default input device.
BufferedInputStream
Values in a record that are separated by commas are called?
comma-separated values
What the two (2) types of storage devices?
Volatile storage and Non-volatile storage
Method that writes a String from position off for length len.
write(String s, int off, int len)
Arguments passed in the newOutputStream are Path and StandardOpenOption. True or False?
True
Method that reads a line of text.
readLine()
Writes all bytes to the output stream from the specified byte array.
void write(byte[] b)
Is the format for creation time mm-dd-yyyyThh:mm:ss? True or False?
False. The format is: yyyy-mm-ddThh:mm:ss
Method that closes the stream, flushing it first.
close()
Contains methods for performing output that never throws an exception.
PrintStream
Abstract class that contains method for performing output.
OutputStream
It compares the relationship between values retrieved from creationTime() or lastModifiedTime().
compareTo()
It consists of data that can be read in a text editor.
Text file
What are the arguments of the checkAccess() method? (4)
None
READ
WRITE
EXECUTE
What is the import used to use both the Path and Files class?
import java.nio.file.*;
Abstract class for reading character streams.
Reader
Permanent files are commonly stored in the home directory. True or False?
False. It is commonly stored in the main directory and root directory.
Writes text to a character-output stream, buffering characters to provide for efficient writing of characters, arrays, and lines.
BufferedWriter
Method used to retrieve useful information about a file.
readAttributes()
Abstract class that contains method for performing input.
InputStream
The complete list of the disk drive plus the hierarchy of directories in which the file is located is called ______ .
path
Closes the output stream and releases any system resources associated with the stream.
void close()
Argument that checks whether the file exists and whether the program has permission to read the file.
READ
Argument that creates a new file only if it hasn’t existed yet; it throws an exception if the file already exists.
CREATE_NEW
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)
What are the two (2) categories of a file?
Text file and binary file
It contains data that is not encoded as text.
Binary file
Argument that checks whether the file exists.
None
Method of the Files class that is used to open a file for reading.
newInputStream()
Provides the capability to read disk from files
FileInputStream
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()
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
It returns the number of name elements in the Path
int getNameCount()
It consists of related records.
file
Method that reads characters into a portion of a array rom position off for len characters.
read(char[] buffer, int off, int len)
It is a method that returns the date and time the file was created.
creationTime()
It clears any bytes that have been sent to a buffer for output but have not yet been displayed on a hardware device.
flushing
It is a collection of data stored on a non-volatile device.
Computer File
What are the arguments of the StandardOpenOption?
WRITE
APPEND
TRUNCATE_EXISTING
CREATE_NEW
CREATE
DELETE_ON_CLOSE
Storage that is temporary. Values are lost when the computer loses its power.
Volatile Storage
Method that writes a line separator.
newline()
Argument that truncates the existing file to 0 yte so the file contents are replaced.
TRUNCATE_EXISTING
It is a special character used to separate path components.
() path delimiter
The readAttributes() method returns an instance of the BasicFileAttributes.class. True or False?
True
Method that closes the stream and any resources associated with it.
close()
Provides the capability to write to disk files.
FileOutputStream
Reads text from a character-input stream, buffering characters to provide efficient reading of characters, arrays, and lines.
BufferedReader
Handles input form a system’s standard or default output device.
BufferedOutputStream
Argument that checks whether the file exists and whether the program has permission to write to the file.
WRITE
A type of stream where data is delivered from a program to a destination.
output stream
What are the methods of the BasicFileAttributes?
size()
creationTime()
lastModifiedTime()
compareTo()