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 aFileInputStreamthat 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 booleancanBeWrapped(FileInputStream fis)Return true if the providedFileInputStreamcan be wrapped to provide mark-and-reset capabilities.static booleanisAlreadyWrapped(FileInputStream fis)Return true if the providedFileInputStreamhas already been wrapped, and therefore supports mark-and-reset capabilities.voidmark(int readlimit)booleanmarkSupported()voidreset()-
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:
markSupportedin classFilterInputStream
-
mark
public void mark(int readlimit)
- Overrides:
markin classFilterInputStream
-
reset
public void reset() throws IOException- Overrides:
resetin classFilterInputStream- Throws:
IOException
-
canBeWrapped
public static boolean canBeWrapped(FileInputStream fis)
Return true if the providedFileInputStreamcan be wrapped to provide mark-and-reset capabilities.- Parameters:
fis- theFileInputStreamto check- Returns:
- true if it can be wrapped
-
isAlreadyWrapped
public static boolean isAlreadyWrapped(FileInputStream fis)
Return true if the providedFileInputStreamhas already been wrapped, and therefore supports mark-and-reset capabilities.- Parameters:
fis- theFileInputStreamto check- Returns:
- true if it is already wrapped
-
-