public class ArArchiveEntry extends java.lang.Object implements ArchiveEntry
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 2This 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. This formats are currently not supported and file names with a bigger size than 16 bytes are not possible at the moment.
Modifier and Type | Field and Description |
---|---|
private static int |
DEFAULT_MODE |
private int |
groupId |
static java.lang.String |
HEADER
The header for each entry
|
private long |
lastModified |
private long |
length |
private int |
mode |
private java.lang.String |
name
SVR4/GNU adds a trailing / to names; BSD does not.
|
static java.lang.String |
TRAILER
The trailer for each entry
|
private int |
userId |
SIZE_UNKNOWN
Constructor and Description |
---|
ArArchiveEntry(java.io.File inputFile,
java.lang.String entryName)
Create a new instance using the attributes of the given file
|
ArArchiveEntry(java.lang.String name,
long length)
Create a new instance using a couple of default values.
|
ArArchiveEntry(java.lang.String name,
long length,
int userId,
int groupId,
int mode,
long lastModified)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
getGroupId() |
long |
getLastModified()
Last modified time in seconds since the epoch.
|
java.util.Date |
getLastModifiedDate()
The last modified date of the entry.
|
long |
getLength() |
int |
getMode() |
java.lang.String |
getName()
The name of the entry in the archive.
|
long |
getSize()
The (uncompressed) size of the entry.
|
int |
getUserId() |
int |
hashCode() |
boolean |
isDirectory()
True if the entry refers to a directory
|
public static final java.lang.String HEADER
public static final java.lang.String TRAILER
private final java.lang.String name
private final int userId
private final int groupId
private final int mode
private static final int DEFAULT_MODE
private final long lastModified
private final long length
public ArArchiveEntry(java.lang.String name, long length)
Sets userId and groupId to 0, the octal file mode to 644 and the last modified time to the current time.
name
- name of the entrylength
- length of the entry in bytespublic ArArchiveEntry(java.lang.String name, long length, int userId, int groupId, int mode, long lastModified)
name
- name of the entrylength
- length of the entry in bytesuserId
- numeric user idgroupId
- numeric group idmode
- file modelastModified
- last modified time in seconds since the epochpublic ArArchiveEntry(java.io.File inputFile, java.lang.String entryName)
public long getSize()
getSize
in interface ArchiveEntry
public java.lang.String getName()
getName
in interface ArchiveEntry
public int getUserId()
public int getGroupId()
public int getMode()
public long getLastModified()
public java.util.Date getLastModifiedDate()
getLastModifiedDate
in interface ArchiveEntry
public long getLength()
public boolean isDirectory()
isDirectory
in interface ArchiveEntry
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object