BufferedOutputStream类
基本概念
java.io.BufferedOutputStream
类主要用于描述缓冲输出流,此时不用为写入的每个字节调用底层系统。
常用的方法
方法声明 | 功能介绍 |
---|---|
BufferedOutputStream(OutputStream out) |
根据参数指定的引用来构造对象 |
BufferedOutputStream(OutputStream out, int size) |
根据参数指定的引用和缓冲区大小来构造对象 |
void write(int b) |
写入单个字节 |
void write(byte b[], int off, int len) |
写入字节数组中的一部分数据 |
void write(byte b[]) |
写入参数指定的整个字节数组 |
void flush() |
刷新流 |
void close() |
关闭流对象并释放有关的资源 |
BufferedInputStream类(重点)
基本概念
java.io.BufferedInputStream
类主要用于描述缓冲输入流。
常用的方法
方法声明 | 功能介绍 |
---|---|
BufferedInputStream(InputStream in) |
根据参数指定的引用构造对象 |
BufferedInputStream(InputStream in, int size) |
根据参数指定的引用和缓冲区大小构造对象 |
int read() |
读取单个字节 |
int read(byte b[], int off, int len) |
读取len个字节 |
int read(byte b[]) |
读取b.length个字节 |
void close() |
关闭流对象并释放有关的资源 |