1/30
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is non-volatile memory?
Memory that is maintained without power, such as hard drives.
What is volatile memory?
Memory that is lost when power is no longer applied, such as RAM.
What are files in the context of computer storage?
Data written to a disk.
What are streams in computing?
Data reservoirs that allow data to flow in and out of a program.
What does it mean when data is serialized?
Data is organized into a single continuous block of memory.
What are directories?
Path information to organize files.
What is a symbolic link?
File that contains a reference to another file.
What is the difference between absolute and relative paths?
Absolute paths contain the exact location of a file, while relative paths depend on the current directory.
How can you write OS-independent file path code in Java?
Use the FileSystem object to pull information about the machine and adapt to its path format.
What is the Path object in Java?
An object that breaks each folder in a file path into an array.
How do you create a file in Java?
Use Files.createFile(Path file) method.
How do you create a directory in Java?
Use Files.createDirectories(Path dir) method.
How can you delete a file or folder in Java?
Use Files.delete(Path path) or Files.deleteIfExists(Path path) methods.
How do you copy a file in Java?
Use Files.copy(Path source, Path target, StandardCopyOption.REPLACE_EXISTING) method.
How can you read an entire file into a byte array in Java?
Use Files.readAllBytes(Path path) method.
How do you write a list of strings to a file in Java?
Use Files.write(Path path, Iterable<? extends CharSequence> lines, Charset charset) method.
What are input and output streams used for?
Input streams read data from a source, and output streams write data to a destination.
What are the four types of streams for files in Java?
Reader, Writer, InputStream, and OutputStream.
How do you create an output stream for writing binary data in Java?
Use Files.newOutputStream(Path path, StandardOpenOption.CREATE, StandardOpenOption.APPEND) and wrap it in a BufferedOutputStream.
How can you read binary data using streams in Java?
Use Files.newInputStream(Path path, StandardOpenOption.READ) and wrap it in a BufferedInputStream.
How do you write text data to a file using PrintWriter in Java?
Create a PrintWriter wrapped around a BufferedWriter.
How do you read text data from a file using BufferedReader in Java?
Use Files.newBufferedReader(Path path, Charset charset) and read lines with BufferedReader.readLine().
What is serialization in Java?
The process of converting an object's state into a byte stream for storage or transmission.
Strength of Serialized Data
Easy to share
Weakness of Serialized Data
Can't easily use dynamic memory
Strength of Non-Serialized Data
Great for dynamic memory like linked lists
Weakness of Non-Serialized Data
Difficult to share
How do you make a Java object serializable?
Implement the java.io.Serializable interface in the class definition.
What is object deserialization in Java?
The process of converting a byte stream back into a copy of the original object.
How do you serialize an object in Java?
Use ObjectOutputStream to write the object to an OutputStream.
How do you deserialize an object in Java?
Use ObjectInputStream to read the object from an InputStream.