rat.document.impl.guesser
Class BinaryGuesser

java.lang.Object
  extended by rat.document.impl.guesser.BinaryGuesser
All Implemented Interfaces:
IDocumentMatcher

public class BinaryGuesser
extends Object
implements IDocumentMatcher


Field Summary
static int ASCII_CHAR_THREASHOLD
           
static String[] BYTECODE_EXTENSIONS
           
static String[] DATA_EXTENSIONS
           
static String[] EXE_EXTENSIONS
           
static int HIGH_BYTES_RATIO
           
static String[] IMAGE_EXTENSIONS
           
static String JAR_MANIFEST
           
static String JAVA
           
static String[] KEYSTORE_EXTENSIONS
           
static int NON_ASCII_THREASHOLD
           
static 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(String name, String[] exts)
           
static boolean extensionMatches(String name, String[] exts)
           
static boolean isBinary(Reader in)
          Do the first few bytes of the stream hint at a binary file?
static boolean isBinary(String name)
          Is a file by that name a known binary file?
static boolean isBinaryData(String name)
           
static boolean isBytecode(String name)
           
static boolean isExecutable(String name)
           
static boolean isImage(String name)
           
static boolean isKeystore(String name)
           
static boolean isNonBinary(String name)
          Is a file by that name a known non-binary file?
 boolean matches(IDocument document)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_EXTENSIONS

public static final String[] DATA_EXTENSIONS

EXE_EXTENSIONS

public static final String[] EXE_EXTENSIONS

KEYSTORE_EXTENSIONS

public static final String[] KEYSTORE_EXTENSIONS

IMAGE_EXTENSIONS

public static final String[] IMAGE_EXTENSIONS

BYTECODE_EXTENSIONS

public static final String[] BYTECODE_EXTENSIONS

NON_BINARY_EXTENSIONS

public static final String[] NON_BINARY_EXTENSIONS
Based on http://www.apache.org/dev/svn-eol-style.txt


JAR_MANIFEST

public static final String JAR_MANIFEST
See Also:
Constant Field Values

JAVA

public static final String JAVA
See Also:
Constant Field Values

HIGH_BYTES_RATIO

public static final int HIGH_BYTES_RATIO
See Also:
Constant Field Values

TOTAL_READ_RATIO

public static final int TOTAL_READ_RATIO
See Also:
Constant Field Values

NON_ASCII_THREASHOLD

public static final int NON_ASCII_THREASHOLD
See Also:
Constant Field Values

ASCII_CHAR_THREASHOLD

public static final int ASCII_CHAR_THREASHOLD
See Also:
Constant Field Values
Constructor Detail

BinaryGuesser

public BinaryGuesser()
Method Detail

isBinary

public static boolean isBinary(Reader in)
Do the first few bytes of the stream hint at a binary file?


isBinaryData

public static final boolean isBinaryData(String name)

isNonBinary

public static final boolean isNonBinary(String name)
Is a file by that name a known non-binary file?


isExecutable

public static final boolean isExecutable(String name)

containsExtension

public static boolean containsExtension(String name,
                                        String[] exts)

extensionMatches

public static boolean extensionMatches(String name,
                                       String[] exts)

isBytecode

public static boolean isBytecode(String name)

isImage

public static final boolean isImage(String name)

isKeystore

public static final boolean isKeystore(String name)

isBinary

public static final boolean isBinary(String name)
Is a file by that name a known binary file?


matches

public boolean matches(IDocument document)
Specified by:
matches in interface IDocumentMatcher


Copyright © 2006-2011. All Rights Reserved.