public class FsSegmentDataInputStream extends FSDataInputStreamWrapper implements WrappingProxyCloseable<FSDataInputStream>
WrappingProxy
for FSDataInputStream
that is
used to read from a file segment. It is opened with a starting position of the file. It treats
the argument of seek(long) as an offset relative to the starting position, rather than an
absolute value.inputStream
Constructor and Description |
---|
FsSegmentDataInputStream(FSDataInputStream inputStream,
long startingPosition,
long segmentSize) |
Modifier and Type | Method and Description |
---|---|
long |
getPos()
Gets the current position in the input stream.
|
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
void |
seek(long desired)
Seek to the given offset from the start of the file.
|
long |
skip(long n) |
available, close, getWrappedDelegate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getWrappedDelegate
public FsSegmentDataInputStream(FSDataInputStream inputStream, long startingPosition, long segmentSize) throws IOException
IOException
public int read() throws IOException
read
in class FSDataInputStreamWrapper
IOException
public int read(byte[] b) throws IOException
read
in class FSDataInputStreamWrapper
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class FSDataInputStreamWrapper
IOException
public void seek(long desired) throws IOException
FSDataInputStream
seek
in class FSDataInputStreamWrapper
desired
- the desired offsetIOException
- Thrown if an error occurred while seeking inside the input stream.public long getPos() throws IOException
FSDataInputStream
getPos
in class FSDataInputStreamWrapper
IOException
- Thrown if an I/O error occurred in the underlying stream implementation
while accessing the stream's position.public long skip(long n) throws IOException
skip
in class FSDataInputStreamWrapper
IOException
public void mark(int readlimit)
mark
in class FSDataInputStreamWrapper
public void reset() throws IOException
reset
in class FSDataInputStreamWrapper
IOException
public boolean markSupported()
markSupported
in class FSDataInputStreamWrapper
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.