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 class
MagicFileNumberTest.Type
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 ?
-
-
-
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, notnull
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
-
-