public class LocalTsFileInput extends Object implements TsFileInput
| Constructor and Description |
|---|
LocalTsFileInput(Path file) |
| 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() |
public LocalTsFileInput(Path file) throws IOException
IOExceptionpublic long size()
throws IOException
TsFileInputsize in interface TsFileInputClosedChannelException - If this channel is closedIOException - If some other I/O error occurspublic long position()
throws IOException
TsFileInputposition in interface TsFileInputClosedChannelException - If this input is closedIOException - If some other I/O error occurspublic TsFileInput position(long newPosition) throws IOException
TsFileInputSetting 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.
position in interface TsFileInputnewPosition - The new position, a non-negative integer counting the number of bytes from
the beginning of the TsFileInputClosedChannelException - If this TsFileInput is closedIOException - If some other I/O error occurspublic int read(ByteBuffer dst) throws IOException
TsFileInputBytes 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.
read in interface TsFileInputIOExceptionpublic int read(ByteBuffer dst, long position) throws IOException
TsFileInputThis method works in the same manner as the TsFileInput.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.
read in interface TsFileInputdst - The buffer into which bytes are to be transferredposition - The position at which the transfer is to begin; must be non-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 occurspublic int read()
TsFileInputread in interface TsFileInputpublic int read(byte[] b,
int off,
int len)
TsFileInputread in interface TsFileInputb - -array of byteoff - -offset of the Inputlen - -lengthpublic FileChannel wrapAsFileChannel()
wrapAsFileChannel in interface TsFileInputpublic InputStream wrapAsInputStream()
wrapAsInputStream in interface TsFileInputpublic void close()
throws IOException
TsFileInputIf the channel has already been closed then this method returns immediately.
close in interface TsFileInputIOException - If an I/O error occurspublic int readInt()
TsFileInputreadInt in interface TsFileInputpublic String readVarIntString(long offset) throws IOException
TsFileInputreadVarIntString in interface TsFileInputIOExceptionpublic String getFilePath()
getFilePath in interface TsFileInputCopyright © 2022 The Apache Software Foundation. All rights reserved.