Package org.apache.tika.parser.strings
Class StringsParser
- java.lang.Object
-
- org.apache.tika.parser.AbstractParser
-
- org.apache.tika.parser.strings.StringsParser
-
- All Implemented Interfaces:
Serializable,org.apache.tika.config.Initializable,org.apache.tika.parser.Parser
public class StringsParser extends org.apache.tika.parser.AbstractParser implements org.apache.tika.config.InitializableParser that uses the "strings" (or strings-alternative) command to find the printable strings in a object, or other binary, file (application/octet-stream). Useful as "best-effort" parser for files detected as application/octet-stream.- Author:
- gtotaro
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StringsParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckInitialization(org.apache.tika.config.InitializableProblemHandler problemHandler)intgetMinLength()StringsEncodinggetStringsEncoding()StringgetStringsPath()static StringgetStringsProg()Set<org.apache.tika.mime.MediaType>getSupportedTypes(org.apache.tika.parser.ParseContext context)intgetTimeoutSeconds()voidinitialize(Map<String,org.apache.tika.config.Param> params)voidparse(InputStream stream, ContentHandler handler, org.apache.tika.metadata.Metadata metadata, org.apache.tika.parser.ParseContext context)voidsetEncoding(String encoding)voidsetMinLength(int minLength)voidsetStringsPath(String path)Sets the "strings" installation folder.voidsetTimeoutSeconds(int timeoutSeconds)
-
-
-
Method Detail
-
getStringsProg
public static String getStringsProg()
-
getSupportedTypes
public Set<org.apache.tika.mime.MediaType> getSupportedTypes(org.apache.tika.parser.ParseContext context)
- Specified by:
getSupportedTypesin interfaceorg.apache.tika.parser.Parser
-
parse
public void parse(InputStream stream, ContentHandler handler, org.apache.tika.metadata.Metadata metadata, org.apache.tika.parser.ParseContext context) throws IOException, SAXException, org.apache.tika.exception.TikaException
- Specified by:
parsein interfaceorg.apache.tika.parser.Parser- Throws:
IOExceptionSAXExceptionorg.apache.tika.exception.TikaException
-
getStringsPath
public String getStringsPath()
-
setStringsPath
@Field public void setStringsPath(String path)
Sets the "strings" installation folder.- Parameters:
path- the "strings" installation folder.
-
setEncoding
@Field public void setEncoding(String encoding)
-
getMinLength
public int getMinLength()
-
setMinLength
@Field public void setMinLength(int minLength)
-
getTimeoutSeconds
public int getTimeoutSeconds()
-
setTimeoutSeconds
@Field public void setTimeoutSeconds(int timeoutSeconds)
-
getStringsEncoding
public StringsEncoding getStringsEncoding()
-
initialize
public void initialize(Map<String,org.apache.tika.config.Param> params) throws org.apache.tika.exception.TikaConfigException
- Specified by:
initializein interfaceorg.apache.tika.config.Initializable- Throws:
org.apache.tika.exception.TikaConfigException
-
checkInitialization
public void checkInitialization(org.apache.tika.config.InitializableProblemHandler problemHandler) throws org.apache.tika.exception.TikaConfigException- Specified by:
checkInitializationin interfaceorg.apache.tika.config.Initializable- Throws:
org.apache.tika.exception.TikaConfigException
-
-