Package org.apache.spark.io
Class ReadAheadInputStream
Object
java.io.InputStream
org.apache.spark.io.ReadAheadInputStream
- All Implemented Interfaces:
- Closeable,- AutoCloseable
InputStream implementation which asynchronously reads ahead from the underlying input
 stream when specified amount of data has been read from the current buffer. It does it by
 maintaining two buffers - active buffer and read ahead buffer. Active buffer contains data
 which should be returned when a read() call is issued. The read ahead buffer is used to
 asynchronously read from the underlying input stream and once the current active buffer is
 exhausted, we flip the two buffers so that we can start reading from the read ahead buffer
 without being blocked in disk I/O.- 
Constructor SummaryConstructorsConstructorDescriptionReadAheadInputStream(InputStream inputStream, int bufferSizeInBytes) Creates aReadAheadInputStreamwith the specified buffer size and read-ahead threshold
- 
Method SummaryMethods inherited from class java.io.InputStreammark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo
- 
Constructor Details- 
ReadAheadInputStreamCreates aReadAheadInputStreamwith the specified buffer size and read-ahead threshold- Parameters:
- inputStream- The underlying input stream.
- bufferSizeInBytes- The buffer size.
 
 
- 
- 
Method Details- 
read- Specified by:
- readin class- InputStream
- Throws:
- IOException
 
- 
read- Overrides:
- readin class- InputStream
- Throws:
- IOException
 
- 
available- Overrides:
- availablein class- InputStream
- Throws:
- IOException
 
- 
skip- Overrides:
- skipin class- InputStream
- Throws:
- IOException
 
- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- InputStream
- Throws:
- IOException
 
 
-