| |
11. 9. 1. 缓冲输入流 |
|
For faster reading you should use BufferedInputStream to wrap any InputStream.
BufferedInputStream has two constructors that accept an InputStream: |
public BufferedInputStream(InputStream in)
public BufferedInput Stream (Input Stream in, int bufferSize)
|
|
For example, the following code wraps a FileInputStream with a BufferedInputStream. |
FileInputStream fis = new FileInputStream(aFile);
BufferedInputStream bis = new BufferedInputStream (fis);
|
|
Then, instead of calling the methods on fis, work with the BufferedInputStream bis. |
|