Closeable
, AutoCloseable
, Comparable<PositionInputStream>
TestInputStream
public class PositionInputStream extends DelegatingInputStream implements Comparable<PositionInputStream>
Constructor | Description |
---|---|
PositionInputStream(InputStream inputStream) |
|
PositionInputStream(InputStream inputStream,
long positionOffset) |
Modifier and Type | Method | Description |
---|---|---|
int |
compareTo(PositionInputStream o) |
|
boolean |
equals(Object obj) |
|
long |
getPosition() |
|
int |
hashCode() |
|
int |
read() |
|
int |
read(byte[] b) |
|
int |
read(byte[] b,
int off,
int len) |
|
long |
seek(long position) |
|
long |
skip(long n) |
This method overrides the
InputStream.skip(long) method to extend the
contract of the method:
This method tries to skip n bytes until the end of the stream or until an
exception is thrown. |
available, close, mark, markSupported, reset, toString
readAllBytes, readNBytes, transferTo
public PositionInputStream(InputStream inputStream)
public PositionInputStream(InputStream inputStream, long positionOffset)
public int read() throws IOException
read
in class DelegatingInputStream
IOException
public int read(byte[] b) throws IOException
read
in class DelegatingInputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class DelegatingInputStream
IOException
public final long getPosition()
public final long seek(long position) throws IOException
IOException
public long skip(long n) throws IOException
DelegatingInputStream
InputStream.skip(long)
method to extend the
contract of the method:
BufferedInputStream
only skip a certain amount of bytes (in this
case until the end of the current buffer) with the first call. Subsequent
calls skip more bytes later on. This is fixed here.skip
in class DelegatingInputStream
n
- is the number bytes to skip.IOException
public int compareTo(PositionInputStream o)
compareTo
in interface Comparable<PositionInputStream>
Copyright © 2017–2018 PureSol Technologies. All rights reserved.