Common base class used to wrap an InputStream with a cipher input stream to encrypt it, and handles resets by attempting to reset on the original, unencrypted data InputStream, and recreate an identical Cipher and identical CipherInputStream on the original data.
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
.
@Deprecated public abstract class AbstractRepeatableCipherInputStream<T> extends SdkFilterInputStream
in
Modifier | Constructor and Description |
---|---|
protected |
AbstractRepeatableCipherInputStream(InputStream input,
FilterInputStream cipherInputStream,
T cipherFactory)
Deprecated.
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 FilterInputStream |
createCipherInputStream(InputStream unencryptedDataStream,
T cipherFactory)
Deprecated.
|
void |
mark(int readlimit)
Deprecated.
|
boolean |
markSupported()
Deprecated.
|
int |
read()
Deprecated.
|
int |
read(byte[] b)
Deprecated.
|
int |
read(byte[] b,
int off,
int len)
Deprecated.
|
void |
reset()
Deprecated.
|
long |
skip(long n)
Deprecated.
|
abort, abortIfNeeded, available, close, isAborted, isMetricActivated, release
protected AbstractRepeatableCipherInputStream(InputStream input, 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 SdkFilterInputStream
public void mark(int readlimit)
mark
in class SdkFilterInputStream
public void reset() throws IOException
reset
in class SdkFilterInputStream
IOException
public int read() throws IOException
read
in class SdkFilterInputStream
IOException
public int read(byte[] b) throws IOException
read
in class FilterInputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class SdkFilterInputStream
IOException
public long skip(long n) throws IOException
skip
in class SdkFilterInputStream
IOException
protected abstract FilterInputStream createCipherInputStream(InputStream unencryptedDataStream, T cipherFactory)
Copyright © 2018. All rights reserved.