Streams
- All modern I/O is stream-based
- A stream is a connection to a source of data or to a destination for data (sometimes both)
- An input stream may be associated with the keyboard
- An input stream or an output stream may be associated with a file
- Different streams have different characteristics:
- A file has a definite length, and therefore an end
- Keyboard input has no specific end
How to do I/O
import java.io.*;
- Open the stream
- Use the stream (read, write, or both)
- Close the stream
File I/O Examples
Below is list of examples which can be user to handle files and their information.
- Java – create a file
- Java – read file using BufferedReader
- Java – Get file name and file path
- Java – Check If File Path Absolute or not
- Java – Get parent directory of the file or directory
- Java – Check file permission and Set file permission
- Java – How to write to a file using FileOutputStream
- Java – How to write to a file using BufferedWriter
- Java – How to get Current Directory in Linux/Windows
- Java – Read File Using Java BufferedInputStream