de.intarsys.tools.file
Class MagicFileNumberTest
java.lang.Object
de.intarsys.tools.file.MagicFileNumberTest
public class MagicFileNumberTest
- extends java.lang.Object
Method Summary |
static void |
addType(java.lang.String fileSuffix,
byte[] magicBytes)
|
protected static void |
addTypes()
|
static java.lang.String |
guessFileSuffix(byte[] data)
|
static java.lang.String |
guessFileSuffix(IRandomAccess data)
|
static boolean |
isText(byte[] data)
does the data contain only ISO-8819-x printable characters ? |
static boolean |
isText(IRandomAccess data)
does the data contain only ISO-8819-x printable characters ? |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
addType
public static void addType(java.lang.String fileSuffix,
byte[] magicBytes)
- Parameters:
fileSuffix
- just the suffix without any starting suffix delimiters (e.g.:
'pdf')magicBytes
- any bytes, not null
or zero size
addTypes
protected static void addTypes()
guessFileSuffix
public static java.lang.String guessFileSuffix(byte[] data)
- Parameters:
data
- any not null or zero size data
- Returns:
- a file suffix without a delimiter (e.g.: 'pdf') or
null
guessFileSuffix
public static java.lang.String guessFileSuffix(IRandomAccess data)
throws java.io.IOException
- Parameters:
data
- any not null or zero size data
- Returns:
- a file suffix without a delimiter (e.g.: 'pdf') or
null
- Throws:
java.io.IOException
isText
public static boolean isText(byte[] data)
- does the data contain only ISO-8819-x printable characters ?
isText
public static boolean isText(IRandomAccess data)
throws java.io.IOException
- does the data contain only ISO-8819-x printable characters ?
- Throws:
java.io.IOException