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.
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 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
- if actually closing the stream throws an exceptionpublic static void closeStream(InputStream is)
Close a stream, dealing properly with KeepOpenInputStream
s.
is
- input stream to closeCopyright © 2016–2024. All rights reserved.