Class MagicFileNumberTest

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

public class MagicFileNumberTest extends Object
  • Method Details

    • 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
    • addTypes

      protected static void addTypes()
    • 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