private static final class CipherStorageProvider.CipherStorageOutputStream extends StorageOutputStream
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
algorithm |
private javax.crypto.CipherOutputStream |
cipherOut |
private javax.crypto.spec.SecretKeySpec |
skeySpec |
private StorageOutputStream |
storageOut |
| Constructor and Description |
|---|
CipherStorageOutputStream(StorageOutputStream out,
java.lang.String algorithm,
javax.crypto.spec.SecretKeySpec skeySpec) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this output stream.
|
protected Storage |
toStorage0()
Has to be implemented by a concrete subclass to create a
Storage
object from the bytes that have been written to this
StorageOutputStream. |
protected void |
write0(byte[] buffer,
int offset,
int length)
Has to implemented by a concrete subclass to write bytes from the given
byte array to this
StorageOutputStream. |
toStorage, write, write, writeprivate final StorageOutputStream storageOut
private final java.lang.String algorithm
private final javax.crypto.spec.SecretKeySpec skeySpec
private final javax.crypto.CipherOutputStream cipherOut
public CipherStorageOutputStream(StorageOutputStream out, java.lang.String algorithm, javax.crypto.spec.SecretKeySpec skeySpec) throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
StorageOutputStreamsuper.close().
This implementation never throws an IOException but a subclass
might.
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class StorageOutputStreamjava.io.IOException - if an I/O error occurs.protected void write0(byte[] buffer,
int offset,
int length)
throws java.io.IOException
StorageOutputStreamStorageOutputStream. This method gets
called by StorageOutputStream.write(int), StorageOutputStream.write(byte[]) and
StorageOutputStream.write(byte[], int, int). All the required preconditions have
already been checked by these methods, including the check if the output
stream has already been closed.write0 in class StorageOutputStreambuffer - buffer containing bytes to write.offset - start offset in the buffer.length - number of bytes to write.java.io.IOException - if an I/O error occurs.protected Storage toStorage0() throws java.io.IOException
StorageOutputStreamStorage
object from the bytes that have been written to this
StorageOutputStream. This method gets called by
StorageOutputStream.toStorage() after the preconditions have been checked. The
implementation can also be sure that this methods gets invoked only once.toStorage0 in class StorageOutputStreamStorage object as described above.java.io.IOException - if an I/O error occurs.