Package com.oracle.bmc.io.internal
Class ResettableFileInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.oracle.bmc.io.internal.ResettableFileInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class ResettableFileInputStream extends FilterInputStream
A wrapper around aFileInputStream
that provides mark-and-reset capabilities.This allows for retries on a
FileInputStream
.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description ResettableFileInputStream(FileInputStream fis)
Constructor for a file input stream that provides mark-and-reset capabilities.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
canBeWrapped(FileInputStream fis)
Return true if the providedFileInputStream
can be wrapped to provide mark-and-reset capabilities.static boolean
isAlreadyWrapped(FileInputStream fis)
Return true if the providedFileInputStream
has already been wrapped, and therefore supports mark-and-reset capabilities.void
mark(int readlimit)
boolean
markSupported()
void
reset()
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
ResettableFileInputStream
public ResettableFileInputStream(FileInputStream fis)
Constructor for a file input stream that provides mark-and-reset capabilities.- Parameters:
fis
- file input stream to wrap- Throws:
IllegalArgumentException
- if the file channel of the file input stream does not provide a position
-
-
Method Detail
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classFilterInputStream
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classFilterInputStream
-
reset
public void reset() throws IOException
- Overrides:
reset
in classFilterInputStream
- Throws:
IOException
-
canBeWrapped
public static boolean canBeWrapped(FileInputStream fis)
Return true if the providedFileInputStream
can be wrapped to provide mark-and-reset capabilities.- Parameters:
fis
- theFileInputStream
to check- Returns:
- true if it can be wrapped
-
isAlreadyWrapped
public static boolean isAlreadyWrapped(FileInputStream fis)
Return true if the providedFileInputStream
has already been wrapped, and therefore supports mark-and-reset capabilities.- Parameters:
fis
- theFileInputStream
to check- Returns:
- true if it is already wrapped
-
-