java.io小结

java io(对于其中的close方法,PrintStream和PrintWriter是不需要捕获的)
Reader下面有:BufferedReader、CharArrayReader、FilterReader、InputStreamReader、PipedReader、StringReader
Writer与Reader相反
InputStream下面:常用的:FileInputStream,ByteArrayInputStream,FilterInputStream(子类PrintStream),ObjectInputStream,PipedInputStream等
OutputStream与InputStream相反
System.in是个InputStream类
节点流:
类型                               字节流                                                            字符流
文件                        FileInputStream/FileOutputStream              FileReader/FileWriter
Memory Array ByteArrayInputStream/ByteArrayOutputStream   CharArrayReader/CharArrayWriter
Memory String           StringReader/StringWriter
pipe                         PipedInputStream/PipedOutputStream         PipedReader/PipedWriter

处理流类型:                      字节流                                                                       字符流
Buffering                 BufferedInputStream/BufferedOutputStream       BufferedReader/BufferedWriter
                               构造函数参数(InputStream,OutputStream)      构造函数参数(Reader,Writer)
Filtering                    FilterInputStream……同上
Converting between                                                                 InputStreamReader/OutputStreamWriter
bytes and character                                       字节转字符   构造函数参数(InputStream,OutputStream)
Object Serialization     ObjectInputStream/OutputStream
Data conversion            DataInputStream/OutputStream
Printing                               PrintStream 参数:OutputStream           PrintWriter 参数:OutputStream、Writer
从控制台获取信息:BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
从文件获取信息:BufferedReader br = new BufferedReader(new FileReader("filepath"));
从socket获取信息:DataInputStream di =new DataInputStream(socket.getInputStream());(TCP)

你可能感兴趣的:(java,socket)