public class FileSystemEmitter extends AbstractEmitter implements StreamEmitter
This calculates the path to write to based on the basePath
and the value of the TikaCoreProperties.SOURCE_PATH
value.
<properties> <emitters> <emitter class="org.apache.tika.pipes.emitter.fs.FileSystemEmitter> <params> <!-- required --> <param name="name" type="string">fs</param> <!-- required --> <param name="basePath" type="string">/path/to/output</param> <!-- optional; default is 'json' --> <param name="fileExtension" type="string">json</param> <!-- optional; if the file already exists, options ('skip', 'replace', 'exception') default is 'exception' --> <param name="onExists" type="string">skip</param> </params> </emitter> </emitters> </properties>
Constructor and Description |
---|
FileSystemEmitter() |
Modifier and Type | Method and Description |
---|---|
void |
emit(String path,
InputStream inputStream,
Metadata userMetadata) |
void |
emit(String emitKey,
List<Metadata> metadataList) |
void |
setBasePath(String basePath) |
void |
setFileExtension(String fileExtension)
If you want to customize the output file's file extension.
|
void |
setOnExists(String onExists)
What to do if the target file already exists.
|
emit, getName, setName
public void emit(String emitKey, List<Metadata> metadataList) throws IOException, TikaEmitterException
emit
in interface Emitter
IOException
TikaEmitterException
@Field public void setFileExtension(String fileExtension)
fileExtension
- @Field public void setOnExists(String onExists)
ON_EXISTS#REPLACE
is chosen,
you still might get a FileAlreadyExistsException
.onExists
- public void emit(String path, InputStream inputStream, Metadata userMetadata) throws IOException, TikaEmitterException
emit
in interface StreamEmitter
IOException
TikaEmitterException
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.