@ThreadSafe public class DoraCachePositionReader extends Object implements PositionReader
PositionReader
that reads data through network from source.Constructor and Description |
---|
DoraCachePositionReader(PositionReader dataReader,
long length,
Optional<CloseableSupplier<PositionReader>> fallbackReader) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the positon reader and do cleanup job if any.
|
int |
readInternal(long position,
ReadTargetBuffer buffer,
int length) |
public DoraCachePositionReader(PositionReader dataReader, long length, Optional<CloseableSupplier<PositionReader>> fallbackReader)
dataReader
- reader to read data through networklength
- file lengthfallbackReader
- the position reader to fallback to when errors happen,
or none if no fallback read is neededpublic int readInternal(long position, ReadTargetBuffer buffer, int length) throws IOException
readInternal
in interface PositionReader
position
- position of the file to start reading databuffer
- target byte bufferlength
- bytes to readIOException
public void close() throws IOException
PositionReader
close
in interface PositionReader
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2023. All Rights Reserved.