public static class LocalFileIO.LocalSeekableInputStream extends SeekableInputStream implements VectoredReadable
SeekableInputStream
.Constructor and Description |
---|
LocalSeekableInputStream(File file) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this input stream and releases any system resources associated with the stream.
|
long |
getPos()
Gets the current position in the input stream.
|
int |
pread(long position,
byte[] b,
int off,
int len)
Read up to the specified number of bytes, from a given position within a file, and return the
number of bytes read.
|
int |
read() |
int |
read(byte[] b,
int off,
int len)
Reads up to
len bytes of data from the input stream into an array of bytes. |
void |
seek(long desired)
Seek to the given offset from the start of the file.
|
available, mark, markSupported, read, reset, skip
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
batchSizeForVectorReads, minSeekForVectorReads, parallelismForVectorReads, preadFully, readVectored
public LocalSeekableInputStream(File file) throws FileNotFoundException
FileNotFoundException
public void seek(long desired) throws IOException
SeekableInputStream
seek
in class SeekableInputStream
desired
- the desired offsetIOException
- Thrown if an error occurred while seeking inside the input stream.public long getPos() throws IOException
SeekableInputStream
getPos
in class SeekableInputStream
IOException
- Thrown if an I/O error occurred in the underlying stream implementation
while accessing the stream's position.public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
SeekableInputStream
len
bytes of data from the input stream into an array of bytes. An
attempt is made to read as many as len
bytes, but a smaller number may be read.
The number of bytes actually read is returned as an integer.read
in class SeekableInputStream
IOException
public void close() throws IOException
SeekableInputStream
The close
method of InputStream
does nothing.
close
in interface Closeable
close
in interface AutoCloseable
close
in class SeekableInputStream
IOException
- if an I/O error occurs.public int pread(long position, byte[] b, int off, int len) throws IOException
VectoredReadable
pread
in interface VectoredReadable
IOException
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.