Class ParseResult

java.lang.Object
org.apache.beam.sdk.io.tika.ParseResult
All Implemented Interfaces:
Serializable

public class ParseResult extends Object implements Serializable
The result of parsing a single file with Tika: contains the file's location, metadata, extracted text, and optionally an error. If there is an error, the metadata and extracted text may be partial (i.e. not represent the entire file).
See Also:
  • Method Details

    • success

      public static ParseResult success(String fileLocation, String content, org.apache.tika.metadata.Metadata metadata)
    • success

      public static ParseResult success(String fileLocation, String content)
    • failure

      public static ParseResult failure(String fileLocation, String partialContent, org.apache.tika.metadata.Metadata partialMetadata, Throwable error)
    • getFileLocation

      public String getFileLocation()
      Returns the absolute path to the input file.
    • isSuccess

      public boolean isSuccess()
      Returns whether this file was parsed successfully.
    • getError

      public Throwable getError()
      Returns the parse error, if the file was parsed unsuccessfully.
    • getErrorAsString

      public String getErrorAsString()
      Same as getError(), but returns the complete stack trace of the error as a String.
    • getContent

      public String getContent()
      Returns the extracted text. May be partial, if this parse result contains a failure.
    • getMetadata

      public org.apache.tika.metadata.Metadata getMetadata()
      Returns the extracted metadata. May be partial, if this parse result contains a failure.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object