Class JarMagicNumber

  • All Implemented Interfaces:
    Comparable<MagicNumber>

    public class JarMagicNumber
    extends MagicNumber
    This class defines a set of informations that could distinguish a file content from another one. It is also known as Magic Number on several operating systems.

    This magic number supports Jar files (ie Zip file with manifest). For general zipped file, please see ZipMagicNumber. For zip archive of files, please see ZipArchiveMagicNumber.

    Since:
    14.0
    Version:
    17.0 2020-01-04 14:41:40
    Author:
    Stéphane GALLAND
    See Also:
    ZipMagicNumber, ZipArchiveMagicNumber
    Maven Group Id:
    org.arakhne.afc.core
    Maven Artifact Id:
    inputoutput
    • Constructor Detail

      • JarMagicNumber

        public JarMagicNumber​(javax.activation.MimeType mimeType)
        Constructor.
        Parameters:
        mimeType - is the MIME type associated to this magic number.
      • JarMagicNumber

        public JarMagicNumber​(javax.activation.MimeType mimeType,
                              String formatVersion)
        Constructor.
        Parameters:
        mimeType - is the MIME type associated to this magic number.
        formatVersion - is the version of the supported format.
    • Method Detail

      • isContentType

        protected final boolean isContentType​(MagicNumberStream stream)
        Description copied from class: MagicNumber
        Replies if the specified stream contains data that corresponds to this magic number.
        Specified by:
        isContentType in class MagicNumber
        Parameters:
        stream - is the stream to analyse.
        Returns:
        true if the stream is containing this magic number, otherwise false
      • isManifestMatch

        public boolean isManifestMatch​(InputStream manifestContent)
        Invoked to test the content of the Jar file manifest.
        Parameters:
        manifestContent - is the content of the manifest
        Returns:
        true if the manifest is matching, otherwise false