Class Content

java.lang.Object
org.deltafi.common.types.Content

public class Content extends Object
A data object that defines a named content reference
  • Constructor Summary

    Constructors
    Constructor
    Description
    Content(String name, String mediaType)
    Create content with no segments
    Content(String name, String mediaType, List<Segment> segments, long ignored)
    Provide an all-args constructor including size, which is a field in graphql but not on the object
    Content(String name, String mediaType, Segment segment)
    Create content with a single segment
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates and returns a copy of the current Content object.
    long
    Calculate size of all the segments
    void
    setSize(long ignored)
    Empty method in place for object mappers trying to set the size from JSON
    subcontent(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 properly
    subcontent(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 properly
    subreferenceSegments(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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Content

      public Content(String name, String mediaType)
      Create content with no segments
      Parameters:
      name - name
      mediaType - mediaType
    • Content

      public Content(String name, String mediaType, Segment segment)
      Create content with a single segment
      Parameters:
      name - name
      mediaType - mediaType
      segment - segment
    • Content

      public Content(String name, String mediaType, List<Segment> segments, long ignored)
      Provide an all-args constructor including size, which is a field in graphql but not on the object
      Parameters:
      name - name
      mediaType - mediaType
      segments - segments
      ignored - 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

      public Content subcontent(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 properly
      Parameters:
      offset - Number of bytes at which to offset the new Content
      size - Size in bytes of the new Content
      name - the name for the new Content
      mediaType - the mediaType for the new Content
      Returns:
      A trimmed down Content
    • subcontent

      public Content subcontent(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 properly
      Parameters:
      offset - Number of bytes at which to offset the new Content
      size - Size in bytes of the new Content
      Returns:
      A trimmed down Content
    • subreferenceSegments

      public List<Segment> subreferenceSegments(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
      Parameters:
      offset - Number of bytes at which to offset the new segments
      size - Size in bytes of the new segments
      Returns:
      A subset of segments in the Content
    • copy

      public 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.