Class FileHeader
java.lang.Object
com.github.junrar.rarfile.BaseBlock
com.github.junrar.rarfile.BlockHeader
com.github.junrar.rarfile.FileHeader
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FileTimeprivate FileTimeprivate FileTimeprivate intprivate final intprivate Stringprivate final byte[]private Stringprivate longprivate longprivate final intprivate intprivate final HostSystemprivate static final org.slf4j.Loggerprivate FileTimeprivate shortprivate static final longprivate static final byteprivate intprivate final byte[]private static final byteprivate byte[]private intprivate byteprivate final longprivate byteFields inherited from class BlockHeader
blockHeaderSizeFields inherited from class BaseBlock
BaseBlockSize, EARC_DATACRC, EARC_NEXT_VOLUME, EARC_REVSPACE, EARC_VOLNUMBER, flags, headCRC, headerSize, headerType, LHD_COMMENT, LHD_DIRECTORY, LHD_EXTFLAGS, LHD_EXTTIME, LHD_LARGE, LHD_PASSWORD, LHD_SALT, LHD_SOLID, LHD_SPLIT_AFTER, LHD_SPLIT_BEFORE, LHD_UNICODE, LHD_VERSION, LHD_WINDOW1024, LHD_WINDOW128, LHD_WINDOW2048, LHD_WINDOW256, LHD_WINDOW4096, LHD_WINDOW512, LHD_WINDOW64, LHD_WINDOWMASK, LONG_BLOCK, MHD_AV, MHD_COMMENT, MHD_ENCRYPTVER, MHD_FIRSTVOLUME, MHD_LOCK, MHD_NEWNUMBERING, MHD_PACK_COMMENT, MHD_PASSWORD, MHD_PROTECT, MHD_SOLID, MHD_VOLUME, positionInFile, SKIP_IF_UNKNOWN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe time in which the file was archived.GetsgetArchivalTime()as aDate.getATime()GetsgetLastAccessTime()as aDate.The time in which the file was created.getCTime()GetsgetCreationTime()as aDate.private static longgetDateDos(int time) intintThe filename either in Unicode or ASCII.byte[]Deprecated.Deprecated.As of 7.2.0, replaced bygetFileName()longlongintintThe time in which the file was last accessed.The time in which the file was last modified.getMTime()GetsgetLastModifiedTime()as aDate.shortintbyte[]getSalt()byte[]intbytelongbytebooleanbooleanhasSalt()booleanwhether this fileheader represents a directorybooleanthe file is encryptedbooleanprivate static booleanisFilenameValid(String filename) booleanbooleanisSolid()this file is compressed as solid (all files handeled as one)booleanthe file will be continued in the next archive partbooleanthe file is continued in this archivebooleanthe filename is also present in unicodeprivate static FileHeader.TimePositionTupleparseExtTime(int shift, short flags, byte[] fileHeader, int position) private static FileHeader.TimePositionTupleparseExtTime(int shift, short flags, byte[] fileHeader, int position, FileTime baseTime) voidprint()voidsetArchivalTime(FileTime archivalTime) Sets the time in which the file was archived.voidsetArcTime(Date arcTime) SetssetArchivalTime(FileTime)from aDate.voidSetssetLastAccessTime(FileTime)from aDate.voidsetCreationTime(FileTime time) Sets the time in which the file was created.voidSetssetCreationTime(FileTime)from aDate.voidsetFileAttr(int fileAttr) voidsetFileName(String fileName) voidsetFileNameW(String fileNameW) voidsetLastAccessTime(FileTime time) Sets the time in which the file was last accessed.voidsetLastModifiedTime(FileTime time) Sets the time in which the file was last modified.voidSetssetLastModifiedTime(FileTime)from aDate.private static Dateprivate static FileTimetoFileTime(Date time) toString()Methods inherited from class BlockHeader
getDataSize, getPackSizeMethods inherited from class BaseBlock
getFlags, getHeadCRC, getHeaderSize, getHeaderSize, getHeaderType, getPositionInFile, hasArchiveDataCRC, hasEncryptVersion, hasVolumeNumber, isSubBlock, setPositionInFile
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
SALT_SIZE
private static final byte SALT_SIZE- See Also:
-
NEWLHD_SIZE
private static final byte NEWLHD_SIZE- See Also:
-
NANOS_PER_UNIT
private static final long NANOS_PER_UNIT- See Also:
-
unpSize
private final long unpSize -
hostOS
-
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
-
fileNameW
-
subData
private byte[] subData -
salt
private final byte[] salt -
mTime
-
cTime
-
aTime
-
arcTime
-
fullPackSize
private long fullPackSize -
fullUnpackSize
private long fullUnpackSize -
fileAttr
private int fileAttr -
subFlags
private int subFlags -
recoverySectors
private int recoverySectors
-
-
Constructor Details
-
FileHeader
- Throws:
CorruptHeaderException
-
-
Method Details
-
isFilenameValid
-
parseExtTime
private static FileHeader.TimePositionTuple parseExtTime(int shift, short flags, byte[] fileHeader, int position) -
parseExtTime
private static FileHeader.TimePositionTuple parseExtTime(int shift, short flags, byte[] fileHeader, int position, FileTime baseTime) -
print
public void print()- Overrides:
printin classBlockHeader
-
getDateDos
private static long getDateDos(int time) -
toDate
-
toFileTime
-
getArchivalTime
-
setArchivalTime
-
getArcTime
GetsgetArchivalTime()as aDate. The maximum granularity is reduced from microseconds to milliseconds.- Returns:
- the date, or null if absent.
-
setArcTime
SetssetArchivalTime(FileTime)from aDate.- Parameters:
arcTime- the date, or null to clear it.
-
getLastAccessTime
-
setLastAccessTime
-
getATime
GetsgetLastAccessTime()as aDate. The maximum granularity is reduced from microseconds to milliseconds.- Returns:
- the date, or null if absent.
-
setATime
SetssetLastAccessTime(FileTime)from aDate.- Parameters:
time- the date, or null to clear it.
-
getCreationTime
-
setCreationTime
-
getCTime
GetsgetCreationTime()as aDate. The maximum granularity is reduced from microseconds to milliseconds.- Returns:
- the date, or null if absent.
-
setCTime
SetssetCreationTime(FileTime)from aDate.- 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
-
setFileName
-
getFileNameW
Deprecated.As of 7.2.0, replaced bygetFileName()The unicode filename.- Returns:
- the Unicode filename, or null if the filename is ASCII only
-
setFileNameW
-
getHighPackSize
public int getHighPackSize() -
getHighUnpackSize
public int getHighUnpackSize() -
getHostOS
-
getLastModifiedTime
-
setLastModifiedTime
-
getMTime
GetsgetLastModifiedTime()as aDate. The maximum granularity is reduced from microseconds to milliseconds.- Returns:
- the date, or null if absent.
-
setMTime
SetssetLastModifiedTime(FileTime)from aDate.- 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
-
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
The filename either in Unicode or ASCII.- Returns:
- the Unicode filename if it exists, else the ASCII filename
- Since:
- 7.2.0
-
getFileName()