Package org.apache.spark.io
Class NioBufferedFileInputStream
Object
java.io.InputStream
org.apache.spark.io.NioBufferedFileInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
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 Summary
-
Method Summary
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo
-
Constructor Details
-
NioBufferedFileInputStream
- Throws:
IOException
-
NioBufferedFileInputStream
- Throws:
IOException
-
-
Method Details
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-