public class CommonsCompressCompoundExtractorService extends java.lang.Object implements CompoundExtractor
Modifier and Type | Field and Description |
---|---|
protected java.nio.charset.Charset |
_charset
encoding.
|
protected static java.lang.String |
APPLICATION_OCTETSTREAM
mime type that can mean almost anything and therefore will be ommitted.
|
protected static java.lang.String |
APPLICATION_ZIP
mime type for ZIP.
|
protected static java.util.Map<java.lang.String,java.lang.String> |
ARCHIVE_IDENTIFIERS
map from mime type to archive stream factory identifier.
|
protected static java.util.Map<java.lang.String,java.lang.String> |
COMPRESSION_IDENTIFIERS
map from mime type to compressor stream factory identifier.
|
protected static java.nio.charset.Charset |
DEFAULT_CHARSET
the default encoding.
|
protected static java.lang.String |
KEY_TMP_FILE_NAME
key for temporary file name.
|
protected static java.lang.String |
SUFFIX_TAR
constant for "tar" suffix.
|
protected static java.lang.String |
SUFFIX_TGZ
constant for "tgz" suffix.
|
KEY_COMMENT, KEY_COMPOUNDS, KEY_COMPRESSED_SIZE, KEY_FILE_NAME, KEY_IS_COMPOUND, KEY_IS_ROOT_COMPOUND_RECORD, KEY_SIZE, KEY_TIME
Constructor and Description |
---|
CommonsCompressCompoundExtractorService() |
Modifier and Type | Method and Description |
---|---|
protected void |
activate()
service activation.
|
boolean |
canExtract(java.io.File file)
Can the file be extracted by the CompoundExtractor service?
|
boolean |
canExtract(java.lang.String fileName,
java.lang.String mimeType)
Can the file be extracted by the CompoundExtractor service?
|
boolean |
canExtract(java.net.URL url,
java.lang.String mimeType)
Can the file be extracted by the CompoundExtractor service?
|
protected void |
deactivate()
service deactivation.
|
java.util.Iterator<Record> |
extract(java.io.InputStream compoundInputStream,
java.lang.String fileName,
java.lang.String contentAttachmentName)
Extract the compounds (recursively) and return an iterator over the resulting records that have been created from
the extracted compound.
|
java.util.Iterator<Record> |
extract(java.io.InputStream compoundInputStream,
java.lang.String fileName,
java.lang.String mimeType,
java.lang.String contentAttachmentName)
Extract the compounds (recursively) and return an iterator over the resulting records that have been created from
the extracted compound.
|
void |
setMimeTypeIdentifier(MimeTypeIdentifier mimeTypeIdentifier)
DS service reference injection method.
|
void |
unsetMimeTypeIdentifier(MimeTypeIdentifier mimeTypeIdentifier)
DS service reference injection method.
|
protected static final java.nio.charset.Charset DEFAULT_CHARSET
protected static final java.lang.String APPLICATION_OCTETSTREAM
protected static final java.lang.String SUFFIX_TAR
protected static final java.lang.String SUFFIX_TGZ
protected static final java.lang.String APPLICATION_ZIP
protected static final java.util.Map<java.lang.String,java.lang.String> COMPRESSION_IDENTIFIERS
protected static final java.util.Map<java.lang.String,java.lang.String> ARCHIVE_IDENTIFIERS
protected static final java.lang.String KEY_TMP_FILE_NAME
protected java.nio.charset.Charset _charset
public CommonsCompressCompoundExtractorService()
protected void activate()
protected void deactivate()
public boolean canExtract(java.io.File file)
true
result does not guarantee, that the file may be
extracted without any exceptions.canExtract
in interface CompoundExtractor
file
- the file in question.true
if the given file can be extracted, false
if not.public boolean canExtract(java.net.URL url, java.lang.String mimeType)
true
result does not
guarantee, that the file may be extracted without any exceptions.canExtract
in interface CompoundExtractor
url
- URL in questionmimeType
- mimetype (if any could be determined)public boolean canExtract(java.lang.String fileName, java.lang.String mimeType)
true
result does not
guarantee, that the file may be extracted without any exceptions.canExtract
in interface CompoundExtractor
fileName
- the name of the file in question.mimeType
- mimetype (if any could be determined)public java.util.Iterator<Record> extract(java.io.InputStream compoundInputStream, java.lang.String fileName, java.lang.String contentAttachmentName) throws CompoundExtractorException
extract
in interface CompoundExtractor
compoundInputStream
- the input stream of the compound object.fileName
- the name of the file in question.contentAttachmentName
- name of attachment to store content of extracted elements in.CompoundExtractorException
- on errors while extracting the compound.public java.util.Iterator<Record> extract(java.io.InputStream compoundInputStream, java.lang.String fileName, java.lang.String mimeType, java.lang.String contentAttachmentName) throws CompoundExtractorException
extract
in interface CompoundExtractor
compoundInputStream
- the input stream of the compound object.fileName
- the name of the file in question.mimeType
- mimetype (if any could be determined)contentAttachmentName
- name of attachment to store content of extracted elements in.CompoundExtractorException
- on errors while extracting the compound.public void setMimeTypeIdentifier(MimeTypeIdentifier mimeTypeIdentifier)
public void unsetMimeTypeIdentifier(MimeTypeIdentifier mimeTypeIdentifier)