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:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
- Enclosing class:
- CipherStorageProvider
private static final class CipherStorageProvider.CipherStorageOutputStream extends StorageOutputStream
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringalgorithmprivate javax.crypto.CipherOutputStreamcipherOutprivate javax.crypto.spec.SecretKeySpecskeySpecprivate StorageOutputStreamstorageOut
-
Constructor Summary
Constructors Constructor Description CipherStorageOutputStream(StorageOutputStream out, java.lang.String algorithm, javax.crypto.spec.SecretKeySpec skeySpec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this output stream.protected StoragetoStorage0()Has to be implemented by a concrete subclass to create aStorageobject from the bytes that have been written to thisStorageOutputStream.protected voidwrite0(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
-
-
-
-
Field Detail
-
storageOut
private final StorageOutputStream storageOut
-
algorithm
private final java.lang.String algorithm
-
skeySpec
private final javax.crypto.spec.SecretKeySpec skeySpec
-
cipherOut
private final javax.crypto.CipherOutputStream cipherOut
-
-
Constructor Detail
-
CipherStorageOutputStream
public CipherStorageOutputStream(StorageOutputStream out, java.lang.String algorithm, javax.crypto.spec.SecretKeySpec skeySpec) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
close
public void close() throws java.io.IOExceptionDescription copied from class:StorageOutputStreamCloses this output stream. Subclasses that override this method have to invokesuper.close().This implementation never throws an
IOExceptionbut a subclass might.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classStorageOutputStream- Throws:
java.io.IOException- if an I/O error occurs.
-
write0
protected void write0(byte[] buffer, int offset, int length) throws java.io.IOExceptionDescription copied from class:StorageOutputStreamHas 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:
write0in classStorageOutputStream- Parameters:
buffer- buffer containing bytes to write.offset- start offset in the buffer.length- number of bytes to write.- Throws:
java.io.IOException- if an I/O error occurs.
-
toStorage0
protected Storage toStorage0() throws java.io.IOException
Description copied from class:StorageOutputStreamHas to be implemented by a concrete subclass to create aStorageobject 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:
toStorage0in classStorageOutputStream- Returns:
- a
Storageobject as described above. - Throws:
java.io.IOException- if an I/O error occurs.
-
-