按照读取方式可分为字节流和字符流,因为java io采用了装饰模式,所以有许多子类和包装类。
InputStream是字节输入流的基类;其子类有:AudioInputStream, ByteArrayInputStream, FileInputStream, FilterInputStream, ObjectInputStream, PipedInputStream, SequenceInputStream, StringBufferInputStream ;比较常用的有 FileInputStream文件输入流和StringBufferInputStream缓冲流。
OutputStream是字节输出流的基类;其子类有:ByteArrayOutputStream, FileOutputStream, FilterOutputStream, ObjectOutputStream, PipedOutputStream,BufferedOutputStream;比较常用的有FileOutputStream文件输出流和BufferedOutputStream缓冲流;
Reader是字符输入流的基类;其子类有:BufferedReader, CharArrayReader, FilterReader, PipedReader, StringReader 比较常用的有StringReader字符输入流和BufferedReader字符缓冲流
Writer是字符输出流的基类,其子类有:BufferedWriter, CharArrayWriter, FilterWriter, OutputStreamWriter, PipedWriter, PrintWriter, StringWriter
比较常用的有BufferedWrite字符输出缓冲流和StringWriter字符输出流
为了提高读写非二进制数据的效率 java io提供了将字节流转换为字符流的类:InputStreamReader和OutputStreamWriter
|