Java 中的 IO 流分类
-
输出 IO 流
-
输出字节流(InputStream)
-
解决流
- 缓冲流(BufferedInputStream)
- 转换流
- 数据流(DataInputStream)
- 规范流(System.in(InputStream))
-
-
输出字符流(Reader)
-
解决流
- 缓冲流(BufferedReader)
- 转换流(InputStreamReader)
- 数据流
- 规范流
-
-
UML 关系图如下所示
PantUML 语法
A <|-- B // B 继承 A
C <|... D // D 实现了 C
@startuml
abstract class InputStream{
}
class BufferedInputStream{
}
class FilterInputStream{
}
class DataInputStream{
}
interface DataInput{
}
abstract class Reader{
}
class BufferedReader{
}
class InputStreamReader{
}
FilterInputStream <|-- BufferedInputStream
InputStream <|-- FilterInputStream
FilterInputStream <|-- DataInputStream
DataInput <|.. DataInputStream
Reader <|-- BufferedReader
Reader <|-- InputStreamReader
@enduml
-
输入 IO 流
-
输入字节流(OutputStream)
-
解决流
- 缓冲流(BufferedOutputStream)
- 转换流
- 数据流(DataOutputStream)
- 规范流(System.out(PrintStream))
-
-
输入字符流(Writer)
-
解决流
- 缓冲流(BufferedWriter)
- 转换流(OutputStreamWriter)
- 数据流
- 规范流(PrintWriter)
-
-
UML 关系图如下所示
PantUML 语法
A <|-- B // B 继承 A
C <|... D // D 实现了 C
@startuml
abstract class OutputStream{ }
class BufferedOutputStream{ }
class FilterOutputStream{ }
class DataOutputStream{ }
class PrintStream{ }
abstract class Writer{ }
class BufferedWriter{ }
class OutputStreamWriter{ }
class PrintWriter{ }
FilterOutputStream <|-- BufferedOutputStream
OutputStream <|-- FilterOutputStream
FilterOutputStream <|-- DataOutputStream
DataOutput <|.. DataOutputStream
FilterOutputStream <|-- PrintStream
Writer <|-- BufferedWriter
Writer <|-- OutputStreamWriter
Writer <|-- PrintWriter
@enduml