Package org.apache.commons.io.input
Class BufferedFileChannelInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.io.input.BufferedFileChannelInputStream
- 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.
 
 To build an instance, use BufferedFileChannelInputStream.Builder.
 
 This class was ported and adapted from Apache Spark commit 933dc6cb7b3de1d8ccaf73d124d6eb95b947ed19 where it was called NioBufferedFileInputStream.
 
- Since:
- 2.9.0
- See Also:
- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructorsConstructorDescriptionDeprecated.BufferedFileChannelInputStream(File file, int bufferSize) Deprecated.Deprecated.BufferedFileChannelInputStream(Path path, int bufferSize) Deprecated.
- 
Method SummaryMethods inherited from class java.io.InputStreammark, markSupported, read, reset
- 
Constructor Details- 
BufferedFileChannelInputStreamDeprecated.Constructs a new instance for the given File.- Parameters:
- file- The file to stream.
- Throws:
- IOException- If an I/O error occurs
 
- 
BufferedFileChannelInputStreamDeprecated.Constructs a new instance for the given File and buffer size.- Parameters:
- file- The file to stream.
- bufferSize- buffer size.
- Throws:
- IOException- If an I/O error occurs
 
- 
BufferedFileChannelInputStreamDeprecated.Constructs a new instance for the given Path.- Parameters:
- path- The path to stream.
- Throws:
- IOException- If an I/O error occurs
 
- 
BufferedFileChannelInputStreamDeprecated.Constructs a new instance for the given Path and buffer size.- Parameters:
- path- The path to stream.
- bufferSize- buffer size.
- Throws:
- IOException- If an I/O error occurs
 
 
- 
- 
Method Details- 
builderConstructs a newBufferedFileChannelInputStream.Builder.- Returns:
- a new BufferedFileChannelInputStream.Builder.
- Since:
- 2.12.0
 
- 
available- Overrides:
- availablein class- InputStream
- Throws:
- IOException
 
- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- InputStream
- Throws:
- IOException
 
- 
read- Specified by:
- readin class- InputStream
- Throws:
- IOException
 
- 
read- Overrides:
- readin class- InputStream
- Throws:
- IOException
 
- 
skip- Overrides:
- skipin class- InputStream
- Throws:
- IOException
 
 
- 
builder(),BufferedFileChannelInputStream.Builder, andBufferedFileChannelInputStream.Builder.get()