Java IO

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. 

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,438评论 0 10
  • 和妈妈一起坐地铁 我喜欢有窗的地方 我跪在这里 看了半小时风景 我一句话都没说 对面的地铁也一句话都没说 直接和我...
    每日爱图阅读 112评论 0 1
  • 【日精进第92天】 刘金璐17178121717 一、【学~勤学】 ①日常课诵 《六项精进》 ②专业成长 《十项职...
    LESSMORE造型Eva金璐阅读 140评论 0 0
  • 有我是日记星球270号星宝宝素梅—素食者王继梅,正在参加日记星球第七期21天蜕变之旅,这是我的第51篇原创日记,坚...
    素梅1素食者王继梅阅读 199评论 0 0