intarsys runtime library

de.intarsys.tools.file
Class MagicFileNumberTest

java.lang.Object
  extended by de.intarsys.tools.file.MagicFileNumberTest

public class MagicFileNumberTest
extends Object


Nested Class Summary
static class MagicFileNumberTest.Type
           
 
Method Summary
static void addType(String fileSuffix, byte[] magicBytes)
           
static String guessFileSuffix(byte[] data)
           
static 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addType

public static void addType(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

guessFileSuffix

public static 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 String guessFileSuffix(IRandomAccess data)
                              throws IOException
Parameters:
data - any not null or zero size data
Returns:
a file suffix without a delimiter (e.g.: 'pdf') or null
Throws:
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 IOException
does the data contain only ISO-8819-x printable characters ?

Throws:
IOException

intarsys runtime library

Copyright © 2008 intarsys consulting GmbH. All Rights Reserved.