Streams Java Help

Streams

Java programs perform rough streams. A stream is an abstraction that either produces or consumes information. A stream is linked to a physical device by the Java I/O system. All streams behave in the same manner, even if the actual physical devices to which they are linked differ. Thus, the same I/O.classes and method scan be applied to any type of device. This means that an input stream can abstract many different . kinds of input: from a disk file, a keyboard, or a network socket. Likewise, an output stream may refer to the console, a disk file, or a network connection. Streams are a clean way to deal with input! output without having every part of your code understand the difference between a keyboard and a network, for example. Java implements streams within class hierarchies defined in the Java package.

Byte Streams and Character Streams 

Java 2 defines two types of streams: byte and character. Byte streams provide a . _convenient means.for handling input and output of bytes. Byte streams arc used, for . example, when reading or writing binary data. Character streams provide a convenient means for handling input and output of characters. They use Unicode and, therefore, can be internationalized. Also, in some cases, character streams arc more efficient than byte streams .

The original version of Java (Java 1.0) did not include character streams and, thus, all I/O was byte-oriented. Character streams were added by Java 1.1, and certain byte-oriented classes and methods were deprecated. This is why older code that doesn’t character streams should be updated ? take advantage of them, where appropriate. One other Poirot: at the lowest level, Joni is still byte-oriented, The character-based streams simply provide a convenient and efficient means for handling characters. . An overview of both byte-oriented streams and character-oriented streams is presented in the following sections.

JavaHelpOnline.com

  • Feel free to send us an inquiry, we will reply back in hours.
 

Verification

Posted on September 17, 2014 in I/O Applets And Other Topics

Share the Story

About the Author

Back to Top
Share This