Each AR archive starts with "!<arch>" followed by a LF. After these 8 bytes the archive entries are listed. The format of an entry header is as it follows:
START BYTE END BYTE NAME FORMAT LENGTH 0 15 File name ASCII 16 16 27 Modification timestamp Decimal 12 28 33 Owner ID Decimal 6 34 39 Group ID Decimal 6 40 47 File mode Octal 8 48 57 File size (bytes) Decimal 10 58 59 File magic \140\012 2
This specifies that an ar archive entry header contains 60 bytes.
Due to the limitation of the file name length to 16 bytes GNU and BSD has their own variants of this format. Currently Commons Compress can read but not write the GNU variant. It fully supports the BSD variant.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private final int | |
| public static final String | HEADER
The header for each entry |
| private final long | |
| private final long | |
| private final int | |
| private final String | name
SVR4/GNU adds a trailing / to names; BSD does not. |
| public static final String | TRAILER
The trailer for each entry |
| private final int |
| Access | Constructor and Description |
|---|---|
| public | ArArchiveEntry(final File
the file to create an entry from inputFile, final String the name of the entry entryName)Creates a new instance using the attributes of the given file |
| public | ArArchiveEntry(final Path
the file to create an entry from inputPath, final String the name of the entry entryName, final LinkOption... options indicating how symbolic links are handled. options)Creates a new instance using the attributes of the given file |
| public | ArArchiveEntry(final String
name of the entry name, final long length of the entry in bytes length)Constructs a new instance using a couple of default values. |
| public | ArArchiveEntry(final String
name of the entry name, final long length of the entry in bytes length, final int numeric user id userId, final int numeric group id groupId, final int file mode mode, final long last modified time in seconds since the epoch lastModified)Constructs a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(final Object
the reference object with which to compare. obj)Overrides java. |
| public int | |
| public long | Returns: the last modified date.Gets the last modified time in seconds since the epoch. |
| public Date | getLastModifiedDate()
Implements org. |
| public long | |
| public int | |
| public String | getName()
Implements org. |
| public long | getSize()
Implements org. |
| public int | |
| public int | |
| public boolean | isDirectory()
Implements org. |
| DEFAULT_MODE | back to summary |
|---|---|
| private static final int DEFAULT_MODE | |
| groupId | back to summary |
|---|---|
| private final int groupId | |
| HEADER | back to summary |
|---|---|
| public static final String HEADER The header for each entry | |
| lastModified | back to summary |
|---|---|
| private final long lastModified | |
| length | back to summary |
|---|---|
| private final long length | |
| mode | back to summary |
|---|---|
| private final int mode | |
| name | back to summary |
|---|---|
| private final String name SVR4/GNU adds a trailing / to names; BSD does not. They also vary in how names longer than 16 characters are represented. (Not yet fully supported by this implementation) | |
| TRAILER | back to summary |
|---|---|
| public static final String TRAILER The trailer for each entry | |
| userId | back to summary |
|---|---|
| private final int userId | |
| ArArchiveEntry | back to summary |
|---|---|
| public ArArchiveEntry(final File inputFile, final String entryName) Creates a new instance using the attributes of the given file | |
| ArArchiveEntry | back to summary |
|---|---|
| public ArArchiveEntry(final Path inputPath, final String entryName, final LinkOption... options) throws IOException Creates a new instance using the attributes of the given file
| |
| ArArchiveEntry | back to summary |
|---|---|
| public ArArchiveEntry(final String name, final long length) Constructs a new instance using a couple of default values. Sets userId and groupId to 0, the octal file mode to 644 and the last modified time to the current time.
| |
| ArArchiveEntry | back to summary |
|---|---|
| public ArArchiveEntry(final String name, final long length, final int userId, final int groupId, final int mode, final long lastModified) Constructs a new instance.
| |
| equals | back to summary |
|---|---|
| public boolean equals(final Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getGroupId | back to summary |
|---|---|
| public int getGroupId() Gets the group ID.
| |
| getLastModified | back to summary |
|---|---|
| public long getLastModified() Gets the last modified time in seconds since the epoch.
| |
| getLastModifiedDate | back to summary |
|---|---|
| public Date getLastModifiedDate() Implements org. Doc from org. Gets the last modified date of this entry. | |
| getLength | back to summary |
|---|---|
| public long getLength() Gets the length.
| |
| getMode | back to summary |
|---|---|
| public int getMode() Gets the mode.
| |
| getName | back to summary |
|---|---|
| public String getName() Implements org. Doc from org. Gets the name of the entry in this archive. May refer to a file or directory or other item. This method returns the raw name as it is stored inside of the archive. | |
| getSize | back to summary |
|---|---|
| public long getSize() Implements org. Doc from org. Gets the uncompressed size of this entry. May be -1 (SIZE_UNKNOWN) if the size is unknown
| |
| getUserId | back to summary |
|---|---|
| public int getUserId() Gets the user ID.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isDirectory | back to summary |
|---|---|
| public boolean isDirectory() Implements org. Doc from org. Tests whether this entry refers to a directory (true).
| |