Package de.intarsys.tools.file
Class MagicFileNumberTest
- java.lang.Object
-
- de.intarsys.tools.file.MagicFileNumberTest
-
public class MagicFileNumberTest extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMagicFileNumberTest.Type
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddType(java.lang.String fileSuffix, byte[] magicBytes)protected static voidaddTypes()static java.lang.StringguessFileSuffix(byte[] data)static java.lang.StringguessFileSuffix(IRandomAccess data)static booleanisText(byte[] data)does the data contain only ISO-8819-x printable characters ?static booleanisText(IRandomAccess data)does the data contain only ISO-8819-x printable characters ?
-
-
-
Method Detail
-
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, notnullor 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
-
-