h4 { margin-top: 0.49cm; margin-bottom: 0.51cm; line-height: 156%; page-break-inside: avoid; }h4.western { font-family: "Arial",sans-serif; font-size: 14pt; }h4.cjk { font-family: "黑体","SimHei"; font-size: 14pt; }h4.ctl { font-family: "DejaVu Sans"; font-size: 14pt; }p { margin-bottom: 0.21cm; }a:link { color: rgb(0, 0, 255); }
InputStream
程序可以从中连续读取字节的对象叫做输入流,在java 中,用InputStream 描述所有流的抽象概念 他是一个抽象类
abstract int | read () |
int | read (byte[] b) |
int | read (byte[] b, int off, int len) |
long | skip (long n) |
int | available () |
void | mark (int readlimit) |
void | reset () |
boolean | markSupported () |
void | close () |
OutputStream
程序可以向其中连续写入字节的对象叫输出流,在java 中,用OutputStream 类来描述所有输出流的抽象概念 输出流都要实现此接口
void | close () |
void | flush () |
void | write (byte[] b) |
void | write (byte[] b, int off, int len) |
abstract void | write (int b) |
使用缓冲区会提供程序运行的效率 但会降低单个程序运行的效率
记录日志文件不要使用缓冲区 因为如果程序崩溃 缓冲区的数据有可能没有写入到硬盘上
只有使用的缓冲区的类才能使用 flush 方法