public class ResettableInputStream extends ReleasableInputStream
ResettableInputStream allows the close operation to
 be disabled via ReleasableInputStream.disableClose() (to avoid accidentally being closed).
 This is necessary when such input stream needs to be marked-and-reset
 multiple times but only as long as the stream has not been closed.
 
 The creator of this input stream should therefore always call
 ReleasableInputStream.release() in a finally block to truly release the underlying
 resources.
Releasable| Constructor and Description | 
|---|
| ResettableInputStream(java.io.File file) | 
| ResettableInputStream(java.io.FileInputStream fis) | 
| Modifier and Type | Method and Description | 
|---|---|
| int | available() | 
| java.io.File | getFile()Returns the underlying file, if known; or null if not; | 
| void | mark(int position)Marks the current position in this input stream. | 
| boolean | markSupported() | 
| static ResettableInputStream | newResettableInputStream(java.io.File file)Convenient factory method to construct a new resettable input stream for
 the given file, converting any IOException into AmazonClientException. | 
| static ResettableInputStream | newResettableInputStream(java.io.FileInputStream fis)Convenient factory method to construct a new resettable input stream for
 the given file input stream, converting any IOException into
 AmazonClientException. | 
| static ResettableInputStream | newResettableInputStream(java.io.FileInputStream fis,
                        java.lang.String errmsg)Convenient factory method to construct a new resettable input stream for
 the given file input stream, converting any IOException into
 AmazonClientException with the given error message. | 
| static ResettableInputStream | newResettableInputStream(java.io.File file,
                        java.lang.String errmsg)Convenient factory method to construct a new resettable input stream for
 the given file, converting any IOException into AmazonClientException
 with the given error message. | 
| int | read() | 
| int | read(byte[] arg0,
    int arg1,
    int arg2) | 
| void | reset()Repositions this stream to the position at the time the
  markmethod was last called on this input stream. | 
| long | skip(long n) | 
close, disableClose, isCloseDisabled, release, wrapabort, abortIfNeeded, isMetricActivatedpublic ResettableInputStream(java.io.File file)
                      throws java.io.IOException
file - must not be null. Upon successful construction the the file
            will be opened with an input stream automatically marked at
            the starting position of the given file.
            
            Note the creation of a ResettableInputStream would
            entail physically opening a file. If the opened file is meant
            to be closed only (in a finally block) by the very same code
            block that created it, then it is necessary that the release
            method must not be called while the execution is made in other
            stack frames.
            In such case, as other stack frames may inadvertently or
            indirectly call the close method of the stream, the creator of
            the stream would need to explicitly disable the accidental
            closing via ReleasableInputStream.disableClose(), so
            that the release method becomes the only way to truly close
            the opened file.
java.io.IOExceptionpublic ResettableInputStream(java.io.FileInputStream fis)
                      throws java.io.IOException
fis - file input stream; must not be null. Upon successful
            construction the input stream will be automatically marked at
            the current position of the given file input stream.
 
 Note the creation of a ResettableInputStream would entail
 physically opening a file. If the opened file is meant to be closed only
 (in a finally block) by the very same code block that created it, then it
 is necessary that the release method must not be called while the
 execution is made in other stack frames.
 In such case, as other stack frames may inadvertently or indirectly call
 the close method of the stream, the creator of the stream would need to
 explicitly disable the accidental closing via
 ReleasableInputStream.disableClose(), so that the release method
 becomes the only way to truly close the opened file.
java.io.IOExceptionpublic final boolean markSupported()
markSupported in class SdkFilterInputStreampublic void mark(int position)
reset method repositions this stream at the last marked
 position so that subsequent reads re-read the same bytes.
 This method works as long as the underlying file has not been closed.
 
 Note the creation of a ResettableInputStream would entail
 physically opening a file. If the opened file is meant to be closed only
 (in a finally block) by the very same code block that created it, then it
 is necessary that the release method must not be called while the
 execution is made in other stack frames.
 In such case, as other stack frames may inadvertently or indirectly call
 the close method of the stream, the creator of the stream would need to
 explicitly disable the accidental closing via
 ReleasableInputStream.disableClose(), so that the release method
 becomes the only way to truly close the opened file.
mark in class SdkFilterInputStreamposition - ignoredpublic void reset()
           throws java.io.IOException
mark method was last called on this input stream.
 This method works as long as the underlying file has not been closed.
 
 Note the creation of a ResettableInputStream would entail
 physically opening a file. If the opened file is meant to be closed only
 (in a finally block) by the very same code block that created it, then it
 is necessary that the release method must not be called while the
 execution is made in other stack frames.
 In such case, as other stack frames may inadvertently or indirectly call
 the close method of the stream, the creator of the stream would need to
 explicitly disable the accidental closing via
 ReleasableInputStream.disableClose(), so that the release method
 becomes the only way to truly close the opened file.
reset in class SdkFilterInputStreamjava.io.IOExceptionpublic int available()
              throws java.io.IOException
available in class SdkFilterInputStreamjava.io.IOExceptionpublic int read()
         throws java.io.IOException
read in class SdkFilterInputStreamjava.io.IOExceptionpublic long skip(long n)
          throws java.io.IOException
skip in class SdkFilterInputStreamjava.io.IOExceptionpublic int read(byte[] arg0,
                int arg1,
                int arg2)
         throws java.io.IOException
read in class SdkFilterInputStreamjava.io.IOExceptionpublic java.io.File getFile()
public static ResettableInputStream newResettableInputStream(java.io.File file)
 Note the creation of a ResettableInputStream would entail
 physically opening a file. If the opened file is meant to be closed only
 (in a finally block) by the very same code block that created it, then it
 is necessary that the release method must not be called while the
 execution is made in other stack frames. In such case, as other stack
 frames may inadvertently or indirectly call the close method of the
 stream, the creator of the stream would need to explicitly disable the
 accidental closing via ReleasableInputStream.disableClose(), so
 that the release method becomes the only way to truly close the opened
 file.
public static ResettableInputStream newResettableInputStream(java.io.File file, java.lang.String errmsg)
 Note the creation of a ResettableInputStream would entail
 physically opening a file. If the opened file is meant to be closed only
 (in a finally block) by the very same code block that created it, then it
 is necessary that the release method must not be called while the
 execution is made in other stack frames. In such case, as other stack
 frames may inadvertently or indirectly call the close method of the
 stream, the creator of the stream would need to explicitly disable the
 accidental closing via ReleasableInputStream.disableClose(), so
 that the release method becomes the only way to truly close the opened
 file.
public static ResettableInputStream newResettableInputStream(java.io.FileInputStream fis)
 Note the creation of a ResettableInputStream would entail
 physically opening a file. If the opened file is meant to be closed only
 (in a finally block) by the very same code block that created it, then it
 is necessary that the release method must not be called while the
 execution is made in other stack frames. In such case, as other stack
 frames may inadvertently or indirectly call the close method of the
 stream, the creator of the stream would need to explicitly disable the
 accidental closing via ReleasableInputStream.disableClose(), so
 that the release method becomes the only way to truly close the opened
 file.
public static ResettableInputStream newResettableInputStream(java.io.FileInputStream fis, java.lang.String errmsg)
 Note the creation of a ResettableInputStream would entail
 physically opening a file. If the opened file is meant to be closed only
 (in a finally block) by the very same code block that created it, then it
 is necessary that the release method must not be called while the
 execution is made in other stack frames. In such case, as other stack
 frames may inadvertently or indirectly call the close method of the
 stream, the creator of the stream would need to explicitly disable the
 accidental closing via ReleasableInputStream.disableClose(), so
 that the release method becomes the only way to truly close the opened
 file.