Interface MultiRecipientContent
- All Superinterfaces:
AutoCloseable, DataContent, Destroyable
Represents one-shot multi-recipient content that owns temporary recipient
resources until processing or explicit cleanup.
Callers must invoke close() when a built instance is abandoned
before getStream() is called. Successful or failed stream
construction also releases the owned recipient resources. Unlocking keys and
password material supplied separately remain caller-owned and are never
destroyed by this content.
Implementations are not thread-safe. Cleanup is idempotent, and content
cannot be used after cleanup. Calling getStream() is terminal even
when stream construction fails.
-
Field Summary
Fields inherited from interface DataContent
DEFAULT_MAX_READ_SIZE -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases all recipient resources still owned by this content.voiddestroy()Destroys all recipient resources still owned by this content.Creates the processed stream and releases all recipient resources.booleanReports whether this content has released its recipient resources.voidsetInput(DataContent input) Connects the upstream content before the one processing attempt.Methods inherited from interface DataContent
toBytes, toText
-
Method Details
-
setInput
Connects the upstream content before the one processing attempt.- Specified by:
setInputin interfaceDataContent- Parameters:
input- non-null upstream plaintext or encrypted content- Throws:
NullPointerException- ifinputisnullIllegalStateException- if this content has already processed input or has been closed
-
getStream
Creates the processed stream and releases all recipient resources.This method may be called only once. Recipient resources are released before it returns or throws. On success, the caller owns the returned stream and must close it; closing this content does not replace closing an already returned stream.
- Specified by:
getStreamin interfaceDataContent- Returns:
- the encrypted or decrypted stream
- Throws:
IOException- if envelope processing, cryptographic stream creation, or resource cleanup failsNullPointerException- if no upstream content was suppliedIllegalStateException- if this content has already processed input or has been closed
-
close
Releases all recipient resources still owned by this content.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- if an owned context cannot be closed
-
destroy
Destroys all recipient resources still owned by this content.- Specified by:
destroyin interfaceDestroyable- Throws:
DestroyFailedException- if cleanup fails
-
isDestroyed
boolean isDestroyed()Reports whether this content has released its recipient resources.- Specified by:
isDestroyedin interfaceDestroyable- Returns:
trueafter processing,close(), ordestroy()
-