Class MagicNumberRegistryEntry.MagicNumber

  • Enclosing class:
    MagicNumberRegistryEntry

    public static class MagicNumberRegistryEntry.MagicNumber
    extends java.lang.Object
    Inner class that represents one magic number. Simply consists of an offset in bytes from the start of the file, and a byte array that must match.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) byte[] buffer  
      (package private) byte[] magicNumber  
      (package private) int offset  
    • Constructor Summary

      Constructors 
      Constructor Description
      MagicNumber​(int offset, byte[] magicNumber)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) int getReadlimit()
      Returns the maximum number of bytes that will be read for this magic number comparison.
      (package private) boolean isMatch​(java.io.InputStream is)
      Performs the check of is.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • offset

        int offset
      • magicNumber

        byte[] magicNumber
      • buffer

        byte[] buffer
    • Constructor Detail

      • MagicNumber

        public MagicNumber​(int offset,
                           byte[] magicNumber)
        Constructor.
        Parameters:
        offset - the location of the magic number in file.
        magicNumber - the sequence of bytes that must match.
    • Method Detail

      • getReadlimit

        int getReadlimit()
        Returns the maximum number of bytes that will be read for this magic number comparison.
      • isMatch

        boolean isMatch​(java.io.InputStream is)
                 throws java.io.StreamCorruptedException
        Performs the check of is.
        Throws:
        java.io.StreamCorruptedException