public class BmcParallelReadAheadFSInputStream extends BmcFSInputStream
FSInputStream
implementation that reads ahead to cache chunks of
data using parallel ranged GET requests. Like in-memory, but memory usage
is limited making it suitable for all files.closed, currentPosition, objectStorage, requestBuilder, sourceInputStream, statistics, status
Constructor and Description |
---|
BmcParallelReadAheadFSInputStream(com.oracle.bmc.objectstorage.ObjectStorage objectStorage,
FileStatus status,
Supplier<com.oracle.bmc.objectstorage.requests.GetObjectRequest.Builder> requestBuilder,
FileSystem.Statistics statistics,
ExecutorService executor,
int ociReadAheadBlockSize,
int readAheadBlockCount) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected long |
doSeek(long position)
Perform the requested seek operation.
|
long |
getPos() |
int |
read() |
int |
read(byte[] buffer,
int offset,
int length) |
int |
read(long position,
byte[] buffer,
int offset,
int length) |
protected int |
readAtPosition(long position,
byte[] buffer,
int offset,
int length)
Reads a specified number of bytes from the input stream at the given absolute position,
without changing the current file offset.
|
void |
readFully(long position,
byte[] buffer,
int offset,
int length) |
void |
seek(long position) |
String |
toString() |
available, getSourceInputStream, getStatistics, seekToNewSource, setSourceInputStream, validateState, wrap
readFully, validatePositionedReadArgs
mark, markSupported, read, reset, skip
public BmcParallelReadAheadFSInputStream(com.oracle.bmc.objectstorage.ObjectStorage objectStorage, FileStatus status, Supplier<com.oracle.bmc.objectstorage.requests.GetObjectRequest.Builder> requestBuilder, FileSystem.Statistics statistics, ExecutorService executor, int ociReadAheadBlockSize, int readAheadBlockCount)
public long getPos()
getPos
in interface Seekable
getPos
in class BmcFSInputStream
public int read() throws IOException
read
in class BmcFSInputStream
IOException
public int read(long position, byte[] buffer, int offset, int length) throws IOException
read
in interface PositionedReadable
read
in class FSInputStream
IOException
public int read(byte[] buffer, int offset, int length) throws IOException
read
in class BmcFSInputStream
IOException
public void readFully(long position, byte[] buffer, int offset, int length) throws IOException
readFully
in interface PositionedReadable
readFully
in class FSInputStream
IOException
protected int readAtPosition(long position, byte[] buffer, int offset, int length) throws IOException
position
- the absolute position in the input stream from where the data should be read.buffer
- the buffer into which the data is read.offset
- the start offset in the buffer at which the data should be written.length
- the maximum number of bytes to be read from the input stream.IOException
- if an I/O error occurs during the read operation.protected long doSeek(long position) throws IOException
BmcFSInputStream
BmcFSInputStream.setSourceInputStream(InputStream)
before returning. The input stream that was
originally created (and wrapped by BmcFSInputStream.wrap(InputStream)
can be obtained from
BmcFSInputStream.getSourceInputStream()
.doSeek
in class BmcFSInputStream
position
- The position to seek to.IOException
- if the operation could not be completedpublic void seek(long position)
seek
in interface Seekable
seek
in class BmcFSInputStream
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class BmcFSInputStream
public String toString()
toString
in class FSInputStream
Copyright © 2016–2023. All rights reserved.