FileInputStream that provides mark-and-reset capabilities.
This allows for retries on a FileInputStream.
| Modifier and Type | Class and Description |
|---|---|
| private class | ResettableFileInputStream.
This is for streams that are already wrapped, i.e. |
| private class | ResettableFileInputStream.
This is for |
| private static interface | ResettableFileInputStream.
State interface for dealing with mark and reset. |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private static final Logger | |
| private final ResettableFileInputStream. |
| Access | Constructor and Description |
|---|---|
| public | ResettableFileInputStream(FileInputStream
file input stream to wrap fis)Constructor for a file input stream that provides mark-and-reset capabilities. |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | Returns: true if it can be wrappedthe fis)FileInputStream to checkReturn true if the provided |
| public static boolean | Returns: true if it is already wrappedthe fis)FileInputStream to checkReturn true if the provided |
| public synchronized void | mark(int
the maximum limit of bytes that can be read before
the mark position becomes invalid. readlimit)Overrides java. Marks the current position in this input stream. |
| public boolean | markSupported()
Overrides java. Tests if this input stream supports the |
| public synchronized void | reset()
Overrides java. Repositions this stream to the position at the time the
|
| alreadyWrapped | back to summary |
|---|---|
| private final boolean alreadyWrapped | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| state | back to summary |
|---|---|
| private final ResettableFileInputStream. | |
| ResettableFileInputStream | back to summary |
|---|---|
| public ResettableFileInputStream(FileInputStream fis) Constructor for a file input stream that provides mark-and-reset capabilities.
| |
| canBeWrapped | back to summary |
|---|---|
| public static boolean canBeWrapped(FileInputStream fis) Return true if the provided
| |
| isAlreadyWrapped | back to summary |
|---|---|
| public static boolean isAlreadyWrapped(FileInputStream fis) Return true if the provided
| |
| mark | back to summary |
|---|---|
| public synchronized void mark(int readlimit) Overrides java. Doc from java. Marks the current position in this input stream. A subsequent
call to the
The
| |
| markSupported | back to summary |
|---|---|
| public boolean markSupported() Overrides java. Doc from java. Tests if this input stream supports the
| |
| reset | back to summary |
|---|---|
| public synchronized void reset() throws IOException Overrides java. Doc from java. Repositions this stream to the position at the time the
Stream marks are intended to be used in situations where you need to read ahead a little to see what's in the stream. Often this is most easily done by invoking some general parser. If the stream is of the type handled by the parse, it just chugs along happily. If the stream is not of that type, the parser should toss an exception when it fails. If this happens within readlimit bytes, it allows the outer code to reset the stream and try another parser.
| |
WrappedFileInputStream.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | |
| public synchronized void |
| AlreadyWrappedState | back to summary |
|---|---|
| private AlreadyWrappedState() | |
| mark | back to summary |
|---|---|
| public synchronized void mark(int readlimit) Implements com.
| |
| reset | back to summary |
|---|---|
| public synchronized void reset() throws IOException Implements com.
| |
FileInputStreams that are not already wrapped.
| Modifier and Type | Field and Description |
|---|---|
| private FileChannel | |
| private long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | |
| public synchronized void |
| fileChannel | back to summary |
|---|---|
| private FileChannel fileChannel | |
| markPosition | back to summary |
|---|---|
| private long markPosition | |
| NeedsToBeWrappedState | back to summary |
|---|---|
| public NeedsToBeWrappedState(FileChannel fileChannel) | |
| mark | back to summary |
|---|---|
| public synchronized void mark(int readlimit) Implements com.
| |
| reset | back to summary |
|---|---|
| public synchronized void reset() throws IOException Implements com.
| |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void |
| mark | back to summary |
|---|---|
public void mark(int readlimit)
| |
| reset | back to summary |
|---|---|
public void reset() throws IOException
| |