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
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).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordInformation about an embedded file stored in the temp directory. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int id, Metadata metadata, InputStream inputStream) voidclose()Returns information about all embedded files stored.Returns the name of the original document if stored.Returns the path to the original document if stored.Returns the temporary directory where embedded files are stored.booleanReturns true if there are any embedded files stored.booleanReturns true if the original document was stored.voidstoreOriginalDocument(InputStream inputStream, String fileName) Stores the original container document for inclusion in the zip.Methods inherited from class org.apache.tika.pipes.core.extractor.AbstractUnpackHandler
getEmitKey, getIds
-
Constructor Details
-
TempFileUnpackHandler
public TempFileUnpackHandler(EmitKey containerEmitKey, UnpackConfig unpackConfig) throws IOException - Throws:
IOException
-
-
Method Details
-
add
- Specified by:
addin interfaceUnpackHandler- Overrides:
addin classAbstractUnpackHandler- Throws:
IOException
-
getTempDirectory
Returns the temporary directory where embedded files are stored. -
getEmbeddedFiles
Returns information about all embedded files stored. -
hasEmbeddedFiles
public boolean hasEmbeddedFiles()Returns true if there are any embedded files stored. -
storeOriginalDocument
Stores the original container document for inclusion in the zip. Call this before parsing if includeOriginal is enabled.- Parameters:
inputStream- the original document input streamfileName- the file name for the original document- Throws:
IOException
-
getOriginalDocumentPath
Returns the path to the original document if stored. -
getOriginalDocumentName
Returns the name of the original document if stored. -
hasOriginalDocument
public boolean hasOriginalDocument()Returns true if the original document was stored. -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-