Class FileHeader


  • public class FileHeader
    extends BlockHeader
    DOCUMENT ME
    Version:
    $LastChangedRevision$
    • Field Detail

      • logger

        private static final org.slf4j.Logger logger
      • unpSize

        private final long unpSize
      • fileCRC

        private final int fileCRC
      • unpVersion

        private byte unpVersion
      • unpMethod

        private byte unpMethod
      • nameSize

        private short nameSize
      • highPackSize

        private final int highPackSize
      • highUnpackSize

        private int highUnpackSize
      • fileNameBytes

        private final byte[] fileNameBytes
      • fileName

        private java.lang.String fileName
      • fileNameW

        private java.lang.String fileNameW
      • subData

        private byte[] subData
      • salt

        private final byte[] salt
      • mTime

        private java.nio.file.attribute.FileTime mTime
      • cTime

        private java.nio.file.attribute.FileTime cTime
      • aTime

        private java.nio.file.attribute.FileTime aTime
      • arcTime

        private java.nio.file.attribute.FileTime arcTime
      • fullPackSize

        private long fullPackSize
      • fullUnpackSize

        private long fullUnpackSize
      • fileAttr

        private int fileAttr
      • subFlags

        private int subFlags
      • recoverySectors

        private int recoverySectors
    • Method Detail

      • isFilenameValid

        private static boolean isFilenameValid​(java.lang.String filename)
      • parseExtTime

        private static FileHeader.TimePositionTuple parseExtTime​(int shift,
                                                                 short flags,
                                                                 byte[] fileHeader,
                                                                 int position,
                                                                 java.nio.file.attribute.FileTime baseTime)
      • getDateDos

        private static long getDateDos​(int time)
      • toDate

        private static java.util.Date toDate​(java.nio.file.attribute.FileTime time)
      • toFileTime

        private static java.nio.file.attribute.FileTime toFileTime​(java.util.Date time)
      • getArchivalTime

        public java.nio.file.attribute.FileTime getArchivalTime()
        The time in which the file was archived. Corresponds to te arcTime field.
        Returns:
        the timestamp, or null if absent.
      • setArchivalTime

        public void setArchivalTime​(java.nio.file.attribute.FileTime archivalTime)
        Sets the time in which the file was archived. Corresponds to te arcTime field.
        Parameters:
        archivalTime - the timestamp, or null to clear it.
      • getArcTime

        public java.util.Date getArcTime()
        Gets getArchivalTime() as a Date. The maximum granularity is reduced from microseconds to milliseconds.
        Returns:
        the date, or null if absent.
      • setArcTime

        public void setArcTime​(java.util.Date arcTime)
        Sets setArchivalTime(FileTime) from a Date.
        Parameters:
        arcTime - the date, or null to clear it.
      • getLastAccessTime

        public java.nio.file.attribute.FileTime getLastAccessTime()
        The time in which the file was last accessed. Corresponds to te aTime field.
        Returns:
        the timestamp, or null if absent.
      • setLastAccessTime

        public void setLastAccessTime​(java.nio.file.attribute.FileTime time)
        Sets the time in which the file was last accessed. Corresponds to te aTime field.
        Parameters:
        time - the timestamp, or null to clear it.
      • getATime

        public java.util.Date getATime()
        Gets getLastAccessTime() as a Date. The maximum granularity is reduced from microseconds to milliseconds.
        Returns:
        the date, or null if absent.
      • setATime

        public void setATime​(java.util.Date time)
        Sets setLastAccessTime(FileTime) from a Date.
        Parameters:
        time - the date, or null to clear it.
      • getCreationTime

        public java.nio.file.attribute.FileTime getCreationTime()
        The time in which the file was created. Corresponds to te cTime field.
        Returns:
        the timestamp, or null if absent.
      • setCreationTime

        public void setCreationTime​(java.nio.file.attribute.FileTime time)
        Sets the time in which the file was created. Corresponds to te cTime field.
        Parameters:
        time - the timestamp, or null to clear it.
      • getCTime

        public java.util.Date getCTime()
        Gets getCreationTime() as a Date. The maximum granularity is reduced from microseconds to milliseconds.
        Returns:
        the date, or null if absent.
      • setCTime

        public void setCTime​(java.util.Date time)
        Sets setCreationTime(FileTime) from a Date.
        Parameters:
        time - the date, or null to clear it.
      • getFileAttr

        public int getFileAttr()
      • setFileAttr

        public void setFileAttr​(int fileAttr)
      • getFileCRC

        public int getFileCRC()
      • getFileNameByteArray

        public byte[] getFileNameByteArray()
      • getFileNameString

        @Deprecated
        public java.lang.String getFileNameString()
        Deprecated.
        As of 7.2.0, replaced by getFileName()
        The ASCII filename.
        Returns:
        the ASCII filename
      • setFileName

        public void setFileName​(java.lang.String fileName)
      • getFileNameW

        @Deprecated
        public java.lang.String getFileNameW()
        Deprecated.
        As of 7.2.0, replaced by getFileName()
        The unicode filename.
        Returns:
        the Unicode filename, or null if the filename is ASCII only
      • setFileNameW

        public void setFileNameW​(java.lang.String fileNameW)
      • getHighPackSize

        public int getHighPackSize()
      • getHighUnpackSize

        public int getHighUnpackSize()
      • getLastModifiedTime

        public java.nio.file.attribute.FileTime getLastModifiedTime()
        The time in which the file was last modified. Corresponds to te mTime field.
        Returns:
        the timestamp, or null if absent.
      • setLastModifiedTime

        public void setLastModifiedTime​(java.nio.file.attribute.FileTime time)
        Sets the time in which the file was last modified. Corresponds to te mTime field.
        Parameters:
        time - the timestamp, or null to clear it.
      • getMTime

        public java.util.Date getMTime()
        Gets getLastModifiedTime() as a Date. The maximum granularity is reduced from microseconds to milliseconds.
        Returns:
        the date, or null if absent.
      • setMTime

        public void setMTime​(java.util.Date time)
        Parameters:
        time - the date, or null to clear it.
      • getNameSize

        public short getNameSize()
      • getRecoverySectors

        public int getRecoverySectors()
      • getSalt

        public byte[] getSalt()
      • getSubData

        public byte[] getSubData()
      • getSubFlags

        public int getSubFlags()
      • getUnpMethod

        public byte getUnpMethod()
      • getUnpSize

        public long getUnpSize()
      • getUnpVersion

        public byte getUnpVersion()
      • getFullPackSize

        public long getFullPackSize()
      • getFullUnpackSize

        public long getFullUnpackSize()
      • toString

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

        public boolean isSplitAfter()
        the file will be continued in the next archive part
        Returns:
        isSplitAfter
      • isSplitBefore

        public boolean isSplitBefore()
        the file is continued in this archive
        Returns:
        isSplitBefore
      • isSolid

        public boolean isSolid()
        this file is compressed as solid (all files handeled as one)
        Returns:
        isSolid
      • isEncrypted

        public boolean isEncrypted()
        the file is encrypted
        Returns:
        isEncrypted
      • isUnicode

        public boolean isUnicode()
        the filename is also present in unicode
        Returns:
        isUnicode
      • isFileHeader

        public boolean isFileHeader()
      • hasSalt

        public boolean hasSalt()
      • hasExtTime

        public boolean hasExtTime()
      • isLargeBlock

        public boolean isLargeBlock()
      • isDirectory

        public boolean isDirectory()
        whether this fileheader represents a directory
        Returns:
        isDirectory
      • getFileName

        public java.lang.String getFileName()
        The filename either in Unicode or ASCII.
        Returns:
        the Unicode filename if it exists, else the ASCII filename
        Since:
        7.2.0