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.Initializable
Parser 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 void
checkInitialization(org.apache.tika.config.InitializableProblemHandler problemHandler)
int
getMinLength()
StringsEncoding
getStringsEncoding()
String
getStringsPath()
static String
getStringsProg()
Set<org.apache.tika.mime.MediaType>
getSupportedTypes(org.apache.tika.parser.ParseContext context)
int
getTimeoutSeconds()
void
initialize(Map<String,org.apache.tika.config.Param> params)
void
parse(InputStream stream, ContentHandler handler, org.apache.tika.metadata.Metadata metadata, org.apache.tika.parser.ParseContext context)
void
setEncoding(String encoding)
void
setMinLength(int minLength)
void
setStringsPath(String path)
Sets the "strings" installation folder.void
setTimeoutSeconds(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:
getSupportedTypes
in 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:
parse
in interfaceorg.apache.tika.parser.Parser
- Throws:
IOException
SAXException
org.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:
initialize
in 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:
checkInitialization
in interfaceorg.apache.tika.config.Initializable
- Throws:
org.apache.tika.exception.TikaConfigException
-
-