Topic 1 Flashcards
What is a stream in Java?
A sequence of data elements that can be read from or written to a specific source
What is a stream pipeline?
The operations that run on a stream to produce a result
What does java.io.Package do?
Provides classes for handling byte and character streams, as well as primitives and objects through serialization
What are the types of streams?
Input and output streams
What is an input stream?
They are used to read data from a source into a program
What is an output stream?
They are used to write data to a local folder on your PC or a location on a network
What are Byte streams
These are used for reading and writing binary data
What is Inheritance?
Byte Streams inherit from InputStream and OutputStream
FileInputStream
Reads bytes from a file
FileOutputStream
Writes bytes to a file
DataInputStream
Allows for reading primitive data types from an underlying input stream
DataOutputStream
Allows for writing primitive data types to an underlying output stream
What does the Read method do?
Reads one byte at a time from a file
What is a file path?
The string provided in the constructor specifies the location of the file
What is String formatting
It allows you to create strings that include dynamic content such as variables or expressions
What are filtered streams?
They modify data as it is read or written through an existing stream
Buffers
Are places in memory where data can be stored before it is needed by a program
Character streams
Are designed for handling data that is based on characters rather than bytes