Class SeekableBAIS
java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
org.apache.drill.exec.vector.complex.fn.SeekableBAIS
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.fs.PositionedReadable,org.apache.hadoop.fs.Seekable
public class SeekableBAIS
extends ByteArrayInputStream
implements org.apache.hadoop.fs.Seekable, org.apache.hadoop.fs.PositionedReadable
A ByteArrayInputStream that supports the HDFS Seekable API.
-
Field Summary
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetPos()intread(long position, byte[] buffer, int offset, int length) Read up to the specified number of bytes, from a given position within a file, and return the number of bytes read.voidreadFully(long position, byte[] buffer) Read number of bytes equal to the length of the buffer, from a given position within a file.voidreadFully(long position, byte[] buffer, int offset, int length) Read the specified number of bytes, from a given position within a file.voidseek(long pos) booleanseekToNewSource(long targetPos) Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, readAllBytes, readNBytes, reset, skip, transferToMethods inherited from class java.io.InputStream
nullInputStream, read, readNBytesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.fs.PositionedReadable
maxReadSizeForVectorReads, minSeekForVectorReads, readVectored
-
Constructor Details
-
SeekableBAIS
public SeekableBAIS(byte[] buf, int offset, int length) -
SeekableBAIS
public SeekableBAIS(byte[] buf)
-
-
Method Details
-
seek
- Specified by:
seekin interfaceorg.apache.hadoop.fs.Seekable- Throws:
IOException
-
getPos
- Specified by:
getPosin interfaceorg.apache.hadoop.fs.Seekable- Throws:
IOException
-
seekToNewSource
- Specified by:
seekToNewSourcein interfaceorg.apache.hadoop.fs.Seekable- Throws:
IOException
-
read
Read up to the specified number of bytes, from a given position within a file, and return the number of bytes read. This does not change the current offset of a file, and is thread-safe. Warning: Not all filesystems satisfy the thread-safety requirement.- Specified by:
readin interfaceorg.apache.hadoop.fs.PositionedReadable- Parameters:
position- position within filebuffer- destination bufferoffset- offset in the bufferlength- number of bytes to read- Returns:
- actual number of bytes read; -1 means "none"
- Throws:
IOException- IO problems.
-
readFully
Read the specified number of bytes, from a given position within a file. This does not change the current offset of a file, and is thread-safe. Warning: Not all filesystems satisfy the thread-safety requirement.- Specified by:
readFullyin interfaceorg.apache.hadoop.fs.PositionedReadable- Parameters:
position- position within filebuffer- destination bufferoffset- offset in the bufferlength- number of bytes to read- Throws:
IOException- IO problems.EOFException- the end of the data was reached before the read operation completed
-
readFully
Read number of bytes equal to the length of the buffer, from a given position within a file. This does not change the current offset of a file, and is thread-safe. Warning: Not all filesystems satisfy the thread-safety requirement.- Specified by:
readFullyin interfaceorg.apache.hadoop.fs.PositionedReadable- Parameters:
position- position within filebuffer- destination buffer- Throws:
IOException- IO problems.EOFException- the end of the data was reached before the read operation completed
-