Package com.oracle.bmc.io.internal
Class KeepOpenInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.oracle.bmc.io.internal.KeepOpenInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public final class KeepOpenInputStream extends FilterInputStream
A wrapper around anInputStream
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.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description KeepOpenInputStream(InputStream is)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static void
closeStream(InputStream is)
Close a stream, dealing properly withKeepOpenInputStream
s.void
doClose()
This method actually closes the stream, what close() is not doing.-
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, read, read, reset, skip
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
KeepOpenInputStream
public KeepOpenInputStream(InputStream is)
-
-
Method Detail
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-
doClose
public void doClose() throws IOException
This method actually closes the stream, what close() is not doing.- Throws:
IOException
- if actually closing the stream throws an exception
-
closeStream
public static void closeStream(InputStream is)
Close a stream, dealing properly withKeepOpenInputStream
s.- Parameters:
is
- input stream to close
-
-