Lesson 14: Working with I/O Streams
Yakov Fain · 2015
Classes that work with streams are located in two packages: java.io and java.nio. Classes from the former implement blocking input/output (I/O): When bytes are being read/written by a process, they become unavailable for other threads of execution. The latter package offers non-blocking I/O with improved performance. This chapter presents examples of performing I/O operations with different streams such as byte streams, buffered streams, character streams and data streams. It also explains a couple of examples of using the class java.nio.Files for working with text files. This helper class consists of multiple static methods that can help you with various file operations. Another interesting feature of NIO is the ability to perform input/output operations asynchronously, which may substantially increase the scalability of your application.