流技术总结
一 流的分类
-
1.按照数据的流向不同可分为输入流和输出流。
-
2.按照数据单位不同可分为字节流和字符流。
-
3.按功能不同可分为节点流和处理流。
二 主要接口
-
Inputstream: 表示所有字节类输入流的超类;
-
Outputstream:表示所有字节输出流的超类;
-
节点流:可以从一个特定的数据源(节点)读取数据;
-
处理流:是连接在已存在的流(节点流或处理流)之上,通过对数据的处理为程序提供跟那个强大的读写功能;
三 File类中的主要常用方法
1. File.canwrite() ----是否可写;
2. File.exists()----是否存在;
3. File.canRead()----是否可写;
4. File.length()----字节长度;
5. File.lastModified()----修改的时间,返回一个lang型的数据;
6. File.isDirectory()----是否是一个目录;
7. File.isFile()----是否为标准文件;
四 InputSteam的基本用法
1. Int read()throws ToException;
2. Void close() throws IoException;
3. Int read(byte[] buffer) throws IoException;
4. Int read(byte[] buffer, int off,int len) throws IoException;
五 OutputSteam的基本用法
1. Int weite() throws ToException;
2. Void close() throws IoException;
3. Int weite() (byte[] buffer) throws IoException;
4. Int weite() (byte[] buffer, int off,int len) throws IoException;
5. Void flush() throws IoException;
六 reader的基本用法
1. Int read()throws ToException;
2. Void close() throws IoException;
3. Int read(byte[] buffer) throws IoException;
4. Int read(byte[] buffer, int off,int len) throws IoException;
七 writer的基本用法
1. Int weite() throws ToException;
2. Void close() throws IoException;
3. Int weite() (byte[] buffer) throws IoException;
4. Int weite() (byte[] buffer, int off,int len) throws IoException;
5. Void flush() throws IoException;