Java IO系列0 InputStream与OutputStream(字节流)
来源:互联网 发布:加盟农村淘宝要多少钱 编辑:程序博客网 时间:2024/06/15 14:44
该系列的分析源码基于Java 1.8.0_45
一、InputStream
public abstract class InputStream extends Object implements Closeable
- Since:
- JDK1.0
private static final int MAX_SKIP_BUFFER_SIZE = 2048;输入流是可以跳过指定字节,但是我们不可能跳过很长的字节,2048就是最大的值
public abstract int read() throws IOException;
读取下一个位置的字节,返回读取的字节,如果返回-1,说明已经到达流的结尾
public int read(byte b[]) throws IOException {
return read(b, 0, b.length);
}
循环把数据读取到b[]字节数组里,位置从1开始,最多读取b.length个字节
该方法返回读入缓冲区的总字节数
public int read(byte b[], int off, int len) throws IOException
循环把数据读取到b[]字节数组里,位置从off开始,最多读取b.length个字节
该方法返回读入缓冲区的总字节数
public long skip(long n) throws IOException
跳过指定最大字节
返回真实跳过字节数
public int available() throws IOException
public synchronized void mark(int readlimit)
public boolean markSupported()
public synchronized void reset() throws IOException
public void close() throws IOException
二、OutputStream
public abstract class OutputStream extends Object implements Closeable, Flushable
- JDK1.0
- public abstract void write(int b) throws IOException;
- 写入一个字节
- public void write(byte b[]) throws IOException
- 把b[ ]数组里的字节写到输出流中
- public void write(byte b[], int off, int len) throws IOException
- 把b[ ]数组里的字节从off位置循环输入len个字节到输入流中
- public void flush() throws IOException
- public void close() throws IOException
- Java IO系列0 InputStream与OutputStream(字节流)
- Java IO 字节流 InputStream和OutputStream
- Java--IO流之字节流介绍--InputStream和OutputStream
- Java IO--字节流与字符流OutputStream/InputStream/Writer/Reader
- Java IO--字节流与字符流OutputStream/InputStream/Writer/Reader
- Java IO--字节流与字符流OutputStream/InputStream/Writer/Reader
- IO流的字节流InputStream、OutputStream
- IO流:InputStream/OutputStream字节流
- IO字节流,OutputStream和InputStream
- Java.IO.InputStream-OutputStream
- Java IO - InputStream&OutputStream
- java.io之InputStream与OutputStream
- Java 字节流InputStream、OutputStream、FileInputStream、FileOutputStream
- JAVA——字节流: InputStream /OutputStream
- Java 字节流InputStream、OutputStream、FileInputStream、FileOutputStream
- Java 字节流InputStream、OutputStream、FileInputStream、FileOutputStream
- Java--IO流(InputStream,OutputStream,拷贝)
- Java知识(IO流、.InputStream和OutputStream)
- java通过DOM操作xml
- 就用这句话激励自己吧
- swift --2
- 使用 tcpdump监听某一端口数据
- MySql错误处理- 错误代码和消息
- Java IO系列0 InputStream与OutputStream(字节流)
- Android学习(3)---Fragment的学习
- C#开启SQLSERVER数据库缓存依赖优化网站性能
- Visual C++6.0 程序设计从入门到精通(三) - MFC的消息机制
- php地址引用
- 开源XListview 的代码分析及使用
- 学习linux的最佳方法
- idea添加jar包
- js 控制滚动条位置