|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.rat.document.impl.guesser.BinaryGuesser
public class BinaryGuesser
TODO: factor into MIME guesser and MIME->binary guesser
Field Summary | |
---|---|
static int |
ASCII_CHAR_THREASHOLD
|
static java.lang.String[] |
BYTECODE_EXTENSIONS
|
static java.lang.String[] |
DATA_EXTENSIONS
|
static java.lang.String[] |
EXE_EXTENSIONS
|
static int |
HIGH_BYTES_RATIO
|
static java.lang.String[] |
IMAGE_EXTENSIONS
|
static java.lang.String |
JAR_MANIFEST
|
static java.lang.String |
JAVA
|
static java.lang.String[] |
KEYSTORE_EXTENSIONS
|
static int |
NON_ASCII_THREASHOLD
|
static java.lang.String[] |
NON_BINARY_EXTENSIONS
Based on http://www.apache.org/dev/svn-eol-style.txt |
static int |
TOTAL_READ_RATIO
|
Constructor Summary | |
---|---|
BinaryGuesser()
|
Method Summary | |
---|---|
static boolean |
containsExtension(java.lang.String name,
java.lang.String[] exts)
|
static boolean |
extensionMatches(java.lang.String name,
java.lang.String[] exts)
|
static boolean |
isBinary(Document document)
|
static boolean |
isBinary(java.io.InputStream in)
Do the first few bytes of the stream hint at a binary file? |
static boolean |
isBinary(java.io.Reader in)
Do the first few bytes of the stream hint at a binary file? |
static boolean |
isBinary(java.lang.String name)
Is a file by that name a known binary file? |
static boolean |
isBinaryData(java.lang.String name)
|
static boolean |
isBytecode(java.lang.String name)
|
static boolean |
isExecutable(java.lang.String name)
|
static boolean |
isImage(java.lang.String name)
|
static boolean |
isKeystore(java.lang.String name)
|
static boolean |
isNonBinary(java.lang.String name)
Is a file by that name a known non-binary file? |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String[] DATA_EXTENSIONS
public static final java.lang.String[] EXE_EXTENSIONS
public static final java.lang.String[] KEYSTORE_EXTENSIONS
public static final java.lang.String[] IMAGE_EXTENSIONS
public static final java.lang.String[] BYTECODE_EXTENSIONS
public static final java.lang.String[] NON_BINARY_EXTENSIONS
public static final java.lang.String JAR_MANIFEST
public static final java.lang.String JAVA
public static final int HIGH_BYTES_RATIO
public static final int TOTAL_READ_RATIO
public static final int NON_ASCII_THREASHOLD
public static final int ASCII_CHAR_THREASHOLD
Constructor Detail |
---|
public BinaryGuesser()
Method Detail |
---|
public static boolean isBinary(java.io.Reader in)
Any IOException is swallowed internally and the test returns false.
This method may lead to false negatives if the reader throws an exception because it can't read characters according to the reader's encoding from the underlying stream.
public static boolean isBinary(java.io.InputStream in)
Any IOException is swallowed internally and the test returns false.
This method will try to read bytes from the stream and translate them to characters according to the platform's default encoding. If any bytes can not be translated to characters it will assume the original data must be binary and return true.
public static final boolean isBinaryData(java.lang.String name)
public static final boolean isNonBinary(java.lang.String name)
public static final boolean isExecutable(java.lang.String name)
public static boolean containsExtension(java.lang.String name, java.lang.String[] exts)
public static boolean extensionMatches(java.lang.String name, java.lang.String[] exts)
public static boolean isBytecode(java.lang.String name)
public static final boolean isImage(java.lang.String name)
public static final boolean isKeystore(java.lang.String name)
public static final boolean isBinary(java.lang.String name)
public static final boolean isBinary(Document document)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |