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 byteshash- 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 Summary
ConstructorsConstructorDescriptionFrictionlessResource(String path, String mediatype, long bytes, String hash, String name) Creates an instance of aFrictionlessResourcerecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongbytes()Returns the value of thebytesrecord component.static FrictionlessResourceCreates a FrictionlessResource without the optional name field.static FrictionlessResourceCreates a FrictionlessResource with all fields.final booleanIndicates whether some other object is "equal to" this one.static StringformatHash(byte[] sha256Bytes) Formats a SHA256 byte array as the Frictionless hash string format.hash()Returns the value of thehashrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of themediatyperecord component.name()Returns the value of thenamerecord component.path()Returns the value of thepathrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
FrictionlessResource
Creates an instance of aFrictionlessResourcerecord class.
-
-
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 packagemediatype- MIME typebytes- file sizehash- SHA256 hash with "sha256:" prefixname- optional original filename- Returns:
- new FrictionlessResource
-
create
Creates a FrictionlessResource without the optional name field.- Parameters:
path- relative path within packagemediatype- MIME typebytes- file sizehash- SHA256 hash with "sha256:" prefix- Returns:
- new FrictionlessResource
-
formatHash
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
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
mediatype
Returns the value of themediatyperecord component.- Returns:
- the value of the
mediatyperecord component
-
bytes
public long bytes()Returns the value of thebytesrecord component.- Returns:
- the value of the
bytesrecord component
-
hash
Returns the value of thehashrecord component.- Returns:
- the value of the
hashrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-