Java IO

作者: 正经三分 | 来源:发表于2018-10-30 16:58 被阅读0次

    Summary

    Direction: Input stream & Output stream.

    Type of data: Byte Stream Classes & Character Stream Classes.

    Byte Stream Classes

     read bytes from an input stream and write bytes to an output stream.

    InputStream

    InputStream class is a base class of all the classes that are used to read bytes from a file, memory or console. InputStream is an abstract class and hence we can't create its object but we can use its subclasses for reading bytes from the input stream.

    OutputStream

    OutputStream class is a base class of all the classes that are used to write bytes to a file, memory or console. OutputStream is an abstract class and hence we can't create its object but we can use its subclasses for writing bytes to the output stream. In the diagram below we have shown the hierarchy of output stream class and some of its important subclasses that are used to write bytes.

    Character Stream Classes

    used to read characters from the source and write characters to the destination.

    two kinds of Character Stream classes - Reader classes and Writer classes. 

    Reader

    Reader class and its subclasses are used to read characters from the source. 

    Reader class is a base class of all the classes that are used to read characters from a file, memory or console. Reader is an abstract class and hence we can't instantiate it but we can use its subclasses for reading characters from the input stream. We will discuss subclasses of Reader class with their code, in the next few articles. 

    Writer

    Writer class and its subclasses are used to write characters to a file, memory or console. Writer is an abstract class and hence we can't create its object but we can use its subclasses for writing characters to the output stream. We will discuss subclasses of Writer with their code in the next few articles. 

    相关文章

      网友评论

          本文标题:Java IO

          本文链接:https://www.haomeiwen.com/subject/xxogtqtx.html