最近看了一下Java io
具体细节不详细描述 推荐一篇文章写的不错,对io简述的比较全面,不过不是很细致 http://www.cnblogs.com/rollenholt/archive/2011/09/11/2173787.html
一下描述一下java io中的主要操作类
字节流
InputStream in = new FileInputStream(new File(path));
OutputStream out = new FileOutputStream(new File(path));
字符流
Reader reader = new FileReader(new File(path));
Writer writer = new FileWriter(new File(path));
字节转字符流
Reader reader = new InputStreamReader(new FileInputStream(new File(path)));
Writer writer = new OutputStreamWriter(new FileOutputStreamWriter(new File(path)));
内存操作流
ByteArrayInputStream in = new ByteArrayInputStream(new byte[10]);
ByteArrayOutputStream out = new ByteArrayOutputStream();
管道流
PipedInputStream in = new PipedInputStream();
PipedOutputStream out = new PipedOutputStream();
Scanner 类
Scanner sca =
new
Scanner(System.in);
合并流
SequenceInputStream in = new SequenceInputStream(new FileInputStream(new File(path)) ,new FileInputStream(new File(path)) );
OutputStream output =
new
FileOutputStream(new File(path));
文件压缩
ZipOutputStream
ZipInputStream
序列话对象
序列化对象又两种方式
1、java自带的要序列化的对象需要实现implements Serializable
2、使用第三方包 xStream.jar 序列化的对象不需要实现或者继承其他类
其他操作类
回退流 PushBackInputStream
数据操作流 DataOutputStream、DataInputStream类
BufferedReader
RandomAccessFil
e