Class FileType


  • public final class FileType
    extends java.lang.Object
    Holds the file extension as String and the corresponding ArchiveFormat and/or CompressionType.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static FileType UNKNOWN
      Special case object for an unknown archive/compression file type.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static FileType get​(java.io.File file)
      Checks the suffix of the given File for an entry in the map.
      static FileType get​(java.lang.String filename)
      Checks the suffix of the given string for an entry in the map.
      ArchiveFormat getArchiveFormat()
      Returns the archive format corresponding to this file extension if any.
      CompressionType getCompressionType()
      Returns the compression type corresponding to this file extension if any.
      java.lang.String getSuffix()
      Returns the file extension suffix (e.g.
      boolean isArchive()
      Returns true if the given file extension denotes an archive.
      boolean isCompressed()
      Returns true if the given file extension denotes a compressed file.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • UNKNOWN

        public static final FileType UNKNOWN
        Special case object for an unknown archive/compression file type.
    • Method Detail

      • isArchive

        public boolean isArchive()
        Returns true if the given file extension denotes an archive.
        Returns:
        true if file extension is an archive, false otherwise
      • isCompressed

        public boolean isCompressed()
        Returns true if the given file extension denotes a compressed file.
        Returns:
        true if file extension is a compressed type, false otherwise
      • getSuffix

        public java.lang.String getSuffix()
        Returns the file extension suffix (e.g. ".zip" or ".tar.gz").
        Returns:
        the file extension suffix
      • getArchiveFormat

        public ArchiveFormat getArchiveFormat()
        Returns the archive format corresponding to this file extension if any.
        Returns:
        the archive format or null if the file extension does not denote an archive
      • getCompressionType

        public CompressionType getCompressionType()
        Returns the compression type corresponding to this file extension if any.
        Returns:
        the compression type or null if the file extension does not denote a compressed file
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • get

        public static FileType get​(java.lang.String filename)
        Checks the suffix of the given string for an entry in the map. If it exists, the corresponding FileType entry will be returned.
        Parameters:
        filename - the filename to check
        Returns:
        a FileType entry for the file extension of the given name, or the UNKNOWN type if it does not exist
      • get

        public static FileType get​(java.io.File file)
        Checks the suffix of the given File for an entry in the map. If it exists, the corresponding FileType entry will be returned.
        Parameters:
        file - the file to check
        Returns:
        a FileType entry for the file extension of the given file, or the UNKNOWN type if it does not exist