Class ImmutableByteContent
java.lang.Object
zeroecho.core.io.ImmutableByteContent
- All Implemented Interfaces:
AutoCloseable, RepeatableContent
Explicit small-value adapter from immutable bytes to repeatable content.
This adapter intentionally materializes its individual value. It is suitable for bounded signatures, public-key fields and external small-object inputs. It must not be used as the authoritative representation of aggregate CRLs, TBS objects or streamed entry sequences.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases implementation-owned resources.Returns a stable, non-secret identifier for integrity and durable provenance.byte[]Returns a defensive copy for an explicitly bounded provider adapter.length()Returns the known aggregate length when cheaply and authoritatively available.Opens a new sequential reader.
-
Constructor Details
-
ImmutableByteContent
public ImmutableByteContent(byte[] bytes) Creates an owned immutable byte value.- Parameters:
bytes- individual value, possibly empty- Throws:
NullPointerException- ifbytesisnull
-
-
Method Details
-
openStream
Description copied from interface:RepeatableContentOpens a new sequential reader.- Specified by:
openStreamin interfaceRepeatableContent- Returns:
- newly opened content stream
-
length
Description copied from interface:RepeatableContentReturns the known aggregate length when cheaply and authoritatively available.- Specified by:
lengthin interfaceRepeatableContent- Returns:
- non-negative length, or empty when the length is unknown
-
contentId
Description copied from interface:RepeatableContentReturns a stable, non-secret identifier for integrity and durable provenance.The identifier is metadata, not authorization, and must not expose a temporary physical path.
- Specified by:
contentIdin interfaceRepeatableContent- Returns:
- stable non-blank identifier
-
copyBytes
public byte[] copyBytes()Returns a defensive copy for an explicitly bounded provider adapter.- Returns:
- newly allocated bytes
-
close
public void close()Description copied from interface:RepeatableContentReleases implementation-owned resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRepeatableContent
-