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,
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.IOException
public NioBufferedFileInputStream(java.io.File file) throws java.io.IOException
java.io.IOException
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int offset, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface AutoCloseable
close
in class java.io.InputStream
java.io.IOException