public class RepeatableCipherInputStream extends AbstractRepeatableCipherInputStream<CipherFactory>
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
.
in
Constructor and Description |
---|
RepeatableCipherInputStream(InputStream input,
CipherFactory 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 FilterInputStream |
createCipherInputStream(InputStream unencryptedDataStream,
CipherFactory cipherFactory) |
mark, markSupported, read, read, read, reset, skip
isMetricActivated
available, close
public RepeatableCipherInputStream(InputStream input, CipherFactory cipherFactory)
input
- The original, unencrypted data stream. This stream should be
markable/resetable in order for this class to work correctly.cipherFactory
- The factory used for creating identical cipher objects when
this stream is reset and a new CipherInputStream is needed.protected FilterInputStream createCipherInputStream(InputStream unencryptedDataStream, CipherFactory cipherFactory)
createCipherInputStream
in class AbstractRepeatableCipherInputStream<CipherFactory>
Copyright © 2016. All rights reserved.