public abstract class AbstractRepeatableCipherInputStream<T> extends SdkFilterInputStream
It's repeatable if and only if the underlying unencryptedDataStream is repeatable - if the underlying input stream is not repeatable and you're going to buffer to make it repeatable anyways, it makes more sense to do so after wrapping in this object, so we buffer the encrypted data and don't have to bother re-encrypting on retry.
This stream only supports being marked before the first call to
read or skip, since it's not possible to rewind the
encryption state of a CipherInputStream to an arbitrary point. If you
call mark after calling read or skip, it will throw
an UnsupportedOperationException.
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRepeatableCipherInputStream(java.io.InputStream input,
java.io.FilterInputStream cipherInputStream,
T cipherFactory)
Constructs a new repeatable cipher input stream using the specified
InputStream as the source data, and the CipherFactory for building
Cipher objects.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract java.io.FilterInputStream |
createCipherInputStream(java.io.InputStream unencryptedDataStream,
T cipherFactory) |
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
abort, abortIfNeeded, available, close, isMetricActivatedprotected AbstractRepeatableCipherInputStream(java.io.InputStream input,
java.io.FilterInputStream cipherInputStream,
T cipherFactory)
input - The original, unencrypted data stream. This stream should be
markable/resetable in order for this class to work correctly.cipherInputStream - The cipher input stream wrapping the original input streamcipherFactory - The factory used for creating identical cipher objects when
this stream is reset and a new CipherInputStream is needed.public boolean markSupported()
markSupported in class SdkFilterInputStreampublic void mark(int readlimit)
mark in class SdkFilterInputStreampublic void reset()
throws java.io.IOException
reset in class SdkFilterInputStreamjava.io.IOExceptionpublic int read()
throws java.io.IOException
read in class SdkFilterInputStreamjava.io.IOExceptionpublic int read(byte[] b)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class SdkFilterInputStreamjava.io.IOExceptionpublic long skip(long n)
throws java.io.IOException
skip in class SdkFilterInputStreamjava.io.IOExceptionprotected abstract java.io.FilterInputStream createCipherInputStream(java.io.InputStream unencryptedDataStream,
T cipherFactory)