Package zeroecho.sdk.content.api
package zeroecho.sdk.content.api
Content abstractions for streaming data in the SDK.
This package defines the common DataContent contract used by SDK
pipelines, plus marker interfaces that classify content as plain or
encrypted, and an extended interface for exporting content in alternate
formats. Implementations expose data via DataContent.getStream() and
may participate in pipelines by accepting upstream input with
DataContent.setInput(DataContent).
Key elements
DataContent- base interface representing a unit of content with stream access and convenience helpers for bytes and text.PlainContent- marker for content representing cleartext or decrypted data.EncryptedContent- marker for content that is the result of encryption and can be stored or transported in untrusted locations.SecretContent- specialization of plain content intended to carry secret phrases.ExportableDataContent- extension that can render content in different export modes viaExportableDataContent.ExportMode(for example, RAW, BASH_SCRIPT, CMD_SCRIPT).AbstractExportableDataContentprovides a small base with input plumbing and mode management.
Usage
Content is consumed as a stream and must be closed by the caller. For small
payloads, helpers like DataContent.toBytes() and
DataContent.toText() can be convenient, but streaming should be
preferred for large data.
// Consume a DataContent instance and write it to an OutputStream.
zeroecho.sdk.content.api.DataContent content = ...obtained from a builder or pipeline ...;
try (java.io.InputStream in = content.getStream()) {
in.transferTo(out);
}
Notes
- Implementations may or may not support
DataContent.setInput(DataContent); the default method throwsUnsupportedOperationExceptionto signal non-participation in chaining. - Exportable content chooses its formatting according to
ExportableDataContent.getExportMode(). - Thread-safety is not guaranteed; consult concrete implementations.
- Since:
- 1.0
-
ClassDescriptionAn abstract base class for exportable data content, providing default implementations for managing input data and export mode.Represents a generic unit of data content.Represents encrypted content, which is the result of an encryption process and can be safely deployed to a public space without security concerns.An extension of
DataContentthat provides export capabilities in different modes.Enumeration of supported export modes.Represents a plain content that includes some original content, such as data from interactive input, a file, or the result of decrypting encrypted content.Represents secret content, which is a specific type of plain content that stores a secret phrase.