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
Constructors -
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:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-