Interface DataContentBuilder<T extends DataContent>
- Type Parameters:
T- the type ofDataContentproduced by this builder
- All Known Subinterfaces:
PlainBytesBuilder, PlainFileBuilder, PlainStringBuilder
- All Known Implementing Classes:
AesDataContentBuilder, ChaChaDataContentBuilder, DigestDataContentBuilder, ElgamalEncDataContentBuilder, HmacDataContentBuilder, KemDataContentBuilder, MultiRecipientDataSourceBuilder, PlainBytesBuilder.DefaultPlainBytesBuilder, PlainFileBuilder.DefaultPlainFileBuilder, PlainStringBuilder.DefaultPlainStringBuilder, RsaEncDataContentBuilder, RsaSigDataContentBuilder, SignatureTrailerDataContentBuilder, TagTrailerDataContentBuilder
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A builder interface for constructing instances of
DataContent.
This interface enables a uniform and extensible way to create various
DataContent implementations in a fluent, builder-based style. It is
intended to be used with builder classes that encapsulate construction
parameters and logic specific to each DataContent subtype.
The build(boolean) method configures the resulting
DataContent instance for either encryption or decryption mode. When
encryption is selected, additional metadata (such as headers) may be added to
the output stream; this metadata must be preserved and reused during
decryption.
Typical usage example:
DataContent content = SomeDataContentBuilder.builder()
.parameterX(...)
.parameterY(...)
.build(true); // true for encryption mode
- Author:
- Leo Galambos
-
Method Summary
Modifier and TypeMethodDescriptionbuild(boolean encrypt) Constructs and returns a newDataContentinstance based on the builder's current configuration.
-
Method Details
-
build
Constructs and returns a newDataContentinstance based on the builder's current configuration.- Parameters:
encrypt- whether the resultingDataContentshould be configured for encryption (true) or decryption (false). In encryption mode, additional headers or metadata may be inserted into the stream which must be retained for successful decryption.- Returns:
- the constructed
DataContentinstance
-