Package org.apache.james.mime4j.storage
Class CipherStorageProvider.CipherStorageOutputStream
java.lang.Object
java.io.OutputStream
org.apache.james.mime4j.storage.StorageOutputStream
org.apache.james.mime4j.storage.CipherStorageProvider.CipherStorageOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
- Enclosing class:
CipherStorageProvider
private static final class CipherStorageProvider.CipherStorageOutputStream
extends StorageOutputStream
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
private final CipherOutputStream
private final SecretKeySpec
private final StorageOutputStream
-
Constructor Summary
ConstructorsConstructorDescriptionCipherStorageOutputStream
(StorageOutputStream out, String algorithm, SecretKeySpec skeySpec) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this output stream.protected Storage
Has to be implemented by a concrete subclass to create aStorage
object from the bytes that have been written to thisStorageOutputStream
.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 thisStorageOutputStream
.Methods inherited from class org.apache.james.mime4j.storage.StorageOutputStream
toStorage, write, write, write
Methods inherited from class java.io.OutputStream
flush, nullOutputStream
-
Field Details
-
storageOut
-
algorithm
-
skeySpec
-
cipherOut
-
-
Constructor Details
-
CipherStorageOutputStream
public CipherStorageOutputStream(StorageOutputStream out, String algorithm, SecretKeySpec skeySpec) throws IOException - Throws:
IOException
-
-
Method Details
-
close
Description copied from class:StorageOutputStream
Closes this output stream. Subclasses that override this method have to invokesuper.close()
.This implementation never throws an
IOException
but a subclass might.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classStorageOutputStream
- Throws:
IOException
- if an I/O error occurs.
-
write0
Description copied from class:StorageOutputStream
Has to implemented by a concrete subclass to write bytes from the given byte array to thisStorageOutputStream
. This method gets called byStorageOutputStream.write(int)
,StorageOutputStream.write(byte[])
andStorageOutputStream.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.- Specified by:
write0
in classStorageOutputStream
- Parameters:
buffer
- buffer containing bytes to write.offset
- start offset in the buffer.length
- number of bytes to write.- Throws:
IOException
- if an I/O error occurs.
-
toStorage0
Description copied from class:StorageOutputStream
Has to be implemented by a concrete subclass to create aStorage
object from the bytes that have been written to thisStorageOutputStream
. This method gets called byStorageOutputStream.toStorage()
after the preconditions have been checked. The implementation can also be sure that this methods gets invoked only once.- Specified by:
toStorage0
in classStorageOutputStream
- Returns:
- a
Storage
object as described above. - Throws:
IOException
- if an I/O error occurs.
-