Record Class FrictionlessResource

java.lang.Object
java.lang.Record
org.apache.tika.pipes.core.extractor.frictionless.FrictionlessResource
Record Components:
path - The relative path to the file within the package (e.g., "unpacked/00000001.pdf")
mediatype - The MIME type of the file (e.g., "application/pdf")
bytes - The file size in bytes
hash - The SHA256 hash in format "sha256:hexstring"
name - Optional original filename if available

public record FrictionlessResource(String path, String mediatype, long bytes, String hash, String name) extends Record
Represents a resource entry in a Frictionless Data Package. See: https://specs.frictionlessdata.io/data-resource/
  • Constructor Details

    • FrictionlessResource

      public FrictionlessResource(String path, String mediatype, long bytes, String hash, String name)
      Creates an instance of a FrictionlessResource record class.
      Parameters:
      path - the value for the path record component
      mediatype - the value for the mediatype record component
      bytes - the value for the bytes record component
      hash - the value for the hash record component
      name - the value for the name record component
  • Method Details

    • create

      public static FrictionlessResource create(String path, String mediatype, long bytes, String hash, String name)
      Creates a FrictionlessResource with all fields.
      Parameters:
      path - relative path within package
      mediatype - MIME type
      bytes - file size
      hash - SHA256 hash with "sha256:" prefix
      name - optional original filename
      Returns:
      new FrictionlessResource
    • create

      public static FrictionlessResource create(String path, String mediatype, long bytes, String hash)
      Creates a FrictionlessResource without the optional name field.
      Parameters:
      path - relative path within package
      mediatype - MIME type
      bytes - file size
      hash - SHA256 hash with "sha256:" prefix
      Returns:
      new FrictionlessResource
    • formatHash

      public static String formatHash(byte[] sha256Bytes)
      Formats a SHA256 byte array as the Frictionless hash string format.
      Parameters:
      sha256Bytes - the raw SHA256 hash bytes
      Returns:
      hash string in format "sha256:hexstring"
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • path

      public String path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • mediatype

      public String mediatype()
      Returns the value of the mediatype record component.
      Returns:
      the value of the mediatype record component
    • bytes

      public long bytes()
      Returns the value of the bytes record component.
      Returns:
      the value of the bytes record component
    • hash

      public String hash()
      Returns the value of the hash record component.
      Returns:
      the value of the hash record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component