Class ContentSlice
java.lang.Object
zeroecho.core.io.ContentSlice
- All Implemented Interfaces:
AutoCloseable, RepeatableContent
Immutable repeatable bounded view over another repeatable content source.
A slice opens a fresh source pass and skips incrementally; it never copies the represented bytes. Closing the slice does not close its source because source ownership remains with the creator.
-
Constructor Summary
ConstructorsConstructorDescriptionContentSlice(RepeatableContent source, long offset, long length) Creates a repeatable slice. -
Method Summary
-
Constructor Details
-
ContentSlice
Creates a repeatable slice.- Parameters:
source- repeatable sourceoffset- non-negative source offsetlength- non-negative slice length- Throws:
IllegalArgumentException- if a range is negative or exceeds a known source length
-
-
Method Details
-
openStream
Description copied from interface:RepeatableContentOpens a new sequential reader.- Specified by:
openStreamin interfaceRepeatableContent- Returns:
- newly opened content stream
- Throws:
IOException- if the immutable content cannot be opened or its integrity cannot be established
-
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
-
close
public void close()Description copied from interface:RepeatableContentReleases implementation-owned resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRepeatableContent
-