Class CryptoOutputStream<K extends MasterKey<K>>

java.lang.Object
java.io.OutputStream
com.amazonaws.encryptionsdk.CryptoOutputStream<K>
Type Parameters:
K - The type of MasterKeys used to manipulate the data.
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class CryptoOutputStream<K extends MasterKey<K>> extends OutputStream
A CryptoOutputStream is a subclass of java.io.OutputStream. It performs cryptographic transformation of the bytes passing through it.

The CryptoOutputStream wraps a provided OutputStream object and performs cryptographic transformation of the bytes written to it. The transformed bytes are then written to the wrapped OutputStream. It uses the cryptography handler provided during construction to invoke methods that perform the cryptographic transformations.

In short, writing to the CryptoOutputStream results in those bytes being cryptographically transformed and written to the wrapped OutputStream.

For example, if the crypto handler provides methods for decryption, the CryptoOutputStream will decrypt the provided ciphertext bytes and write the plaintext bytes to the wrapped OutputStream.

This class adheres strictly to the semantics, especially the failure semantics, of its ancestor class java.io.OutputStream. This class overrides all the methods specified in its ancestor class.

To instantiate an instance of this class, please see AwsCrypto.