Interface DataContentBuilder<T extends DataContent>

Type Parameters:
T - the type of DataContent produced 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.

@FunctionalInterface public interface DataContentBuilder<T extends DataContent>
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 Type
    Method
    Description
    build(boolean encrypt)
    Constructs and returns a new DataContent instance based on the builder's current configuration.
  • Method Details

    • build

      T build(boolean encrypt)
      Constructs and returns a new DataContent instance based on the builder's current configuration.
      Parameters:
      encrypt - whether the resulting DataContent should 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 DataContent instance