Class TempFileUnpackHandler

java.lang.Object
org.apache.tika.pipes.core.extractor.AbstractUnpackHandler
org.apache.tika.pipes.core.extractor.TempFileUnpackHandler
All Implemented Interfaces:
Closeable, AutoCloseable, UnpackHandler

public class TempFileUnpackHandler extends AbstractUnpackHandler implements Closeable
An UnpackHandler that writes embedded bytes to a temporary directory for later zipping. Files are stored with their emit key names (flattened, with path separators replaced).
  • Constructor Details

  • Method Details

    • add

      public void add(int id, Metadata metadata, InputStream inputStream) throws IOException
      Specified by:
      add in interface UnpackHandler
      Overrides:
      add in class AbstractUnpackHandler
      Throws:
      IOException
    • getTempDirectory

      public Path getTempDirectory()
      Returns the temporary directory where embedded files are stored.
    • getEmbeddedFiles

      public List<TempFileUnpackHandler.EmbeddedFileInfo> getEmbeddedFiles()
      Returns information about all embedded files stored.
    • hasEmbeddedFiles

      public boolean hasEmbeddedFiles()
      Returns true if there are any embedded files stored.
    • storeOriginalDocument

      public void storeOriginalDocument(InputStream inputStream, String fileName) throws IOException
      Stores the original container document for inclusion in the zip. Call this before parsing if includeOriginal is enabled.
      Parameters:
      inputStream - the original document input stream
      fileName - the file name for the original document
      Throws:
      IOException
    • getOriginalDocumentPath

      public Path getOriginalDocumentPath()
      Returns the path to the original document if stored.
    • getOriginalDocumentName

      public String getOriginalDocumentName()
      Returns the name of the original document if stored.
    • hasOriginalDocument

      public boolean hasOriginalDocument()
      Returns true if the original document was stored.
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException