@NotThreadSafe public final class MarkSupportedInputStream extends InputStream
Wraps an InputStream
to ensure InputStream.markSupported()
returns true
.
Note: if calls to read()
exceed the readLimit
parameter of mark(int)
then the mark is removed and a call to reset()
will throw an IOException
.
Constructor and Description |
---|
MarkSupportedInputStream(InputStream delegate)
Create an InputStream with mark supported
|
Modifier and Type | Method and Description |
---|---|
static InputStream |
ensureMarkSupported(InputStream input)
For efficient use of memory, this convenience static method
returns the
input argument IFF it claims to to support marking,
otherwise the stream is wrapped |
void |
mark(int readLimit) |
boolean |
markSupported() |
int |
read() |
void |
reset() |
public MarkSupportedInputStream(InputStream delegate)
delegate
- the InputStream
to wrappublic static InputStream ensureMarkSupported(InputStream input)
input
argument IFF it claims to to support marking,
otherwise the stream is wrappedinput
- the InputStream
to checkInputStream
that supports markingpublic int read() throws IOException
read
in class InputStream
IOException
public final boolean markSupported()
markSupported
in class InputStream
public void mark(int readLimit)
mark
in class InputStream
public void reset() throws IOException
reset
in class InputStream
IOException
Copyright © 2017–2018 earcam. All rights reserved.