Package org.deltafi.common.types
Class Content
java.lang.Object
org.deltafi.common.types.Content
A data object that defines a named content reference
-
Constructor Summary
ConstructorsConstructorDescriptionCreate content with no segmentsProvide an all-args constructor including size, which is a field in graphql but not on the objectCreate content with a single segment -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates and returns a copy of the current Content object.longgetSize()Calculate size of all the segmentsvoidsetSize(long ignored) Empty method in place for object mappers trying to set the size from JSONsubcontent(long offset, long size) Returns a new Content that is a copy of a portion of this Content, at the given offset and size Handles piecing together the underlying segments properlysubcontent(long offset, long size, String name, String mediaType) Returns a new Content that is a copy of a portion of this Content, 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 Content, at the given offset and size Handles piecing together the underlying segments properly
-
Constructor Details
-
Content
-
Content
Create content with no segments- Parameters:
name- namemediaType- mediaType
-
Content
Create content with a single segment- Parameters:
name- namemediaType- mediaTypesegment- segment
-
Content
Provide an all-args constructor including size, which is a field in graphql but not on the object- Parameters:
name- namemediaType- 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
-
subcontent
Returns a new Content that is a copy of a portion of this Content, at the given offset and size Handles piecing together the underlying segments properly- Parameters:
offset- Number of bytes at which to offset the new Contentsize- Size in bytes of the new Contentname- the name for the new ContentmediaType- the mediaType for the new Content- Returns:
- A trimmed down Content
-
subcontent
Returns a new Content that is a copy of a portion of this Content, at the given offset and size Handles piecing together the underlying segments properly- Parameters:
offset- Number of bytes at which to offset the new Contentsize- Size in bytes of the new Content- Returns:
- A trimmed down Content
-
subreferenceSegments
Returns a list of Segments that copy portions of this Content, 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 Content
-
copy
Creates and returns a copy of the current Content object.- Returns:
- A new Content object that is a copy of the current object. The segments are copied into a new ArrayList.
-