public final class NioBufferedFileInputStream
extends java.io.InputStream
InputStream implementation which uses direct buffer
to read a file to avoid extra copy of data between Java and
native memory which happens when using BufferedInputStream.
Unfortunately, this is not something already available in JDK,
sun.nio.ch.ChannelInputStream supports reading a file using nio,
but does not support buffering.| Constructor and Description |
|---|
NioBufferedFileInputStream(java.io.File file) |
NioBufferedFileInputStream(java.io.File file,
int bufferSizeInBytes) |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
int |
read() |
int |
read(byte[] b,
int offset,
int len) |
long |
skip(long n) |
public NioBufferedFileInputStream(java.io.File file,
int bufferSizeInBytes)
throws java.io.IOException
java.io.IOExceptionpublic NioBufferedFileInputStream(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int offset,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic long skip(long n)
throws java.io.IOException
skip in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface AutoCloseableclose in class java.io.InputStreamjava.io.IOException