1.Java的字節流
InputStream是全部字節輸入流的祖先,而OutputStream是全部字節輸出流的祖先。
2.Java的字符流
Reader是全部讀取字符串輸入流的祖先,而Writer是全部輸出字符串的祖先。
InputStream,OutputStream,Reader,writer都是抽象類。編碼
這兩個之間經過 InputStreamReader,OutputStreamWriter來關聯,其實是經過byte[]和String來關聯
在實際開發中出現的漢字問題實際上都是在字符流和字節流之間轉化不統一而形成的
在從字節流轉化爲字符流時,實際上就是byte[]轉化爲String時,
public String(byte bytes[], String charsetName)
有一個關鍵的參數字符集編碼,一般咱們都省略了,那系統就用操做系統的lang
而在字符流轉化爲字節流時,其實是String轉化爲byte[]時,
byte[] String.getBytes(String charsetName)
也是同樣的道理
spa
直接已知子類:操作系統
AudioInputStream, ByteArrayInputStream, FileInputStream, FilterInputStream, InputStream, ObjectInputStream, PipedInputStream, SequenceInputStream, StringBufferInputStreamip
直接已知子類:開發
BufferedInputStream, CheckedInputStream, CipherInputStream, DataInputStream, DeflaterInputStream, DigestInputStream, InflaterInputStream, LineNumberInputStream, ProgressMonitorInputStream, PushbackInputStream字符串
直接已知子類:get
ByteArrayOutputStream, FileOutputStream, FilterOutputStream, ObjectOutputStream, OutputStream, PipedOutputStreamit
直接已知子類:io
BufferedOutputStream, CheckedOutputStream, CipherOutputStream, DataOutputStream, DeflaterOutputStream, DigestOutputStream, InflaterOutputStream, PrintStreamdi