public final class KeepOpenInputStream extends FilterInputStream
A wrapper around an InputStream
that turns the close
method into a no-op, and
requires the calling of the doClose
method instead.
This is necessary, because Jersey closes a stream once it has been read, but we may want to reset and read it again for retries.
Modifier and Type | Field and Description |
---|---|
InputStream |
innerStream |
in
Constructor and Description |
---|
KeepOpenInputStream(InputStream is) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
static void |
closeStream(InputStream is)
Close a stream, dealing properly with
KeepOpenInputStream s. |
void |
doClose()
This method actually closes the stream, what
close() is not doing. |
available, mark, markSupported, read, read, read, reset, skip
public volatile InputStream innerStream
public KeepOpenInputStream(InputStream is)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterInputStream
IOException
public void doClose() throws IOException
This method actually closes the stream, what close()
is not doing.
IOException
public static void closeStream(InputStream is)
Close a stream, dealing properly with KeepOpenInputStream
s.
is
- input stream to closeCopyright © 2016–2023. All rights reserved.