Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Chapter 13: Input/Output > Input/Output Streams - Pg. 248

} } Note that the read and write methods in Files are only good for small files. For medium-sized and large files, use streams instead. Input/Output Streams I/O streams can be likened to water pipes. Just like water pipes connect city houses to a water reservoir, a Java stream connects Java code to a "data reservoir." In Java terminology, this "data reservoir" is called a sink and could be a file, a network socket, or memory. The good thing about streams is you employ a uniform way to transport data from and to different sinks, hence simplifying your code. You just need to construct the correct stream. Depending on the data direction, there are two types of streams, input