Package org.apache.tika.parser.strings
Class StringsParser
java.lang.Object
org.apache.tika.parser.strings.StringsParser
- All Implemented Interfaces:
Serializable
,org.apache.tika.config.Initializable
,org.apache.tika.parser.Parser
public class StringsParser
extends Object
implements org.apache.tika.parser.Parser, 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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkInitialization
(org.apache.tika.config.InitializableProblemHandler problemHandler) int
static String
Set<org.apache.tika.mime.MediaType>
getSupportedTypes
(org.apache.tika.parser.ParseContext context) int
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)
-
Constructor Details
-
StringsParser
public StringsParser()
-
-
Method Details
-
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
-
setStringsPath
Sets the "strings" installation folder.- Parameters:
path
- the "strings" installation folder.
-
setEncoding
-
getMinLength
public int getMinLength() -
setMinLength
@Field public void setMinLength(int minLength) -
getTimeoutSeconds
public int getTimeoutSeconds() -
setTimeoutSeconds
@Field public void setTimeoutSeconds(int timeoutSeconds) -
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
-