Package org.deltafi.common.content
Class ContentReference
java.lang.Object
org.deltafi.common.content.ContentReference
-
Constructor Summary
ConstructorsConstructorDescriptionContentReference(String mediaType, List<Segment> segments, long ignored) Provide an all-args constructor including size, which is a field in graphql but not on the objectContentReference(String mediaType, Segment... segments) -
Method Summary
Modifier and TypeMethodDescriptionlonggetSize()Calculate size of all the segmentsstatic longvoidsetSize(long ignored) Empty method in place for object mappers trying to set the size from JSONsubreference(long offset, long size) Returns a new ContentReference that is a copy of a portion of this ContentReference, at the given offset and size Handles piecing together the underlying segments properlysubreferenceSegments(long offset, long size) Returns a list of Segments that copy portions of this ContentReference, at the given offset and size Handles piecing together the underlying segments properlystatic longsumSegmentSizes(List<Segment> segments)
-
Constructor Details
-
ContentReference
-
ContentReference
Provide an all-args constructor including size, which is a field in graphql but not on the object- Parameters:
mediaType- mediaTypesegments- segmentsignored- placeholder for size
-
-
Method Details
-
setSize
public void setSize(long ignored) Empty method in place for object mappers trying to set the size from JSON- Parameters:
ignored- ignored field
-
getSize
public long getSize()Calculate size of all the segments- Returns:
- total size
-
subreference
Returns a new ContentReference that is a copy of a portion of this ContentReference, at the given offset and size Handles piecing together the underlying segments properly- Parameters:
offset- Number of bytes at which to offset the new ContentReferencesize- Size in bytes of the new ContentReference- Returns:
- A trimmed down ContentReference
-
subreferenceSegments
Returns a list of Segments that copy portions of this ContentReference, at the given offset and size Handles piecing together the underlying segments properly- Parameters:
offset- Number of bytes at which to offset the new segmentssize- Size in bytes of the new segments- Returns:
- A subset of segments in the ContentReference
-
sumSegmentSizes
-
minOffset
-