Using unbuffered I/O like FileReader can be inefficient because the read requests are handled directly by the operating system.
* directly by the operating system 운영 체제에서 직접, inefficient 비효율적
Using buffered streams can make a program more efficient. Data is written to or read from a buffer, and the native API is only called when the buffer is full. This reduces the number of necessary expensive operations like disk accecss or network activity.
A buffered stream an be created by passing an unbuggered stream object to a buffered stream constructor. For example:
input = new BufferedReader(new FileReader("in.txt"));
output = new BufferedWriter(new FileWriter("out.txt"));'Java - English ver' 카테고리의 다른 글
| Flushing buffered sreams (1) | 2024.11.13 |
|---|---|
| Type inference in generic calsses (0) | 2024.11.11 |
| Writing generic classes (0) | 2024.11.09 |
| Using bounded type parameters in generic methods (3) | 2024.11.08 |
| Type Inference in Generic Methods (3) | 2024.11.07 |