Class ImmutableByteContent

java.lang.Object
zeroecho.core.io.ImmutableByteContent
All Implemented Interfaces:
AutoCloseable, RepeatableContent

public final class ImmutableByteContent extends Object implements 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 Details

    • ImmutableByteContent

      public ImmutableByteContent(byte[] bytes)
      Creates an owned immutable byte value.
      Parameters:
      bytes - individual value, possibly empty
      Throws:
      NullPointerException - if bytes is null
  • Method Details

    • openStream

      public InputStream openStream()
      Description copied from interface: RepeatableContent
      Opens a new sequential reader.
      Specified by:
      openStream in interface RepeatableContent
      Returns:
      newly opened content stream
    • length

      public OptionalLong length()
      Description copied from interface: RepeatableContent
      Returns the known aggregate length when cheaply and authoritatively available.
      Specified by:
      length in interface RepeatableContent
      Returns:
      non-negative length, or empty when the length is unknown
    • contentId

      public String contentId()
      Description copied from interface: RepeatableContent
      Returns 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:
      contentId in interface RepeatableContent
      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: RepeatableContent
      Releases implementation-owned resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface RepeatableContent