public interface TsFileInput
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this channel.
|
String |
getFilePath() |
long |
position()
Returns this input's current position.
|
TsFileInput |
position(long newPosition)
Sets this input's position.
|
int |
read()
read a byte from the Input.
|
int |
read(byte[] b,
int off,
int len)
read an array of byte from the Input.
|
int |
read(ByteBuffer dst)
Reads a sequence of bytes from this TsFileInput into the given buffer.
|
int |
read(ByteBuffer dst,
long position)
Reads a sequence of bytes from this TsFileInput into the given buffer, starting at the given
position.
|
int |
readInt()
read 4 bytes from the Input and convert it to a integer.
|
String |
readVarIntString(long offset)
read a string from the Input at the given position
|
long |
size()
Returns the current size of this input.
|
FileChannel |
wrapAsFileChannel() |
InputStream |
wrapAsInputStream() |
long size() throws IOException
ClosedChannelException - If this channel is closedIOException - If some other I/O error occurslong position()
throws IOException
ClosedChannelException - If this input is closedIOException - If some other I/O error occursTsFileInput position(long newPosition) throws IOException
Setting the position to a value that is greater than the input's current size is legal but does not change the size of the TsFileInput. A later attempt to read bytes at such a position will immediately return an end-of-file indication.
newPosition - The new position, a non-negative integer counting the number of bytes from
the beginning of the TsFileInputClosedChannelException - If this TsFileInput is closedIllegalArgumentException - If the new position is negativeIOException - If some other I/O error occursint read(ByteBuffer dst) throws IOException
Bytes are read starting at this TsFileInput's current position, and then the position is
updated with the number of bytes actually read. Otherwise this method behaves exactly as
specified in the ReadableByteChannel interface.
IOExceptionint read(ByteBuffer dst, long position) throws IOException
This method works in the same manner as the read(ByteBuffer) method, except that
bytes are read starting at the given position rather than at the TsFileInput's current
position. This method does not modify this TsFileInput's position. If the given position is
greater than the TsFileInput's current size then no bytes are read.
dst - The buffer into which bytes are to be transferredposition - The position at which the transfer is to begin; must be non-negativeIllegalArgumentException - If the position is negativeClosedChannelException - If this TsFileInput is closedAsynchronousCloseException - If another thread closes this TsFileInput while the read
operation is in progressClosedByInterruptException - If another thread interrupts the current thread while the
read operation is in progress, thereby closing the channel and setting the current thread's
interrupt statusIOException - If some other I/O error occursint read() throws IOException
IOExceptionint read(byte[] b,
int off,
int len)
throws IOException
b - -array of byteoff - -offset of the Inputlen - -lengthIOExceptionFileChannel wrapAsFileChannel() throws IOException
IOExceptionInputStream wrapAsInputStream() throws IOException
IOExceptionvoid close()
throws IOException
If the channel has already been closed then this method returns immediately.
IOException - If an I/O error occursint readInt()
throws IOException
IOExceptionString readVarIntString(long offset) throws IOException
IOExceptionString getFilePath()
Copyright © 2022 The Apache Software Foundation. All rights reserved.