org.apache.commons.compress.archivers.ar
public class ArArchiveEntry extends 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. Currently Commons Compress can read but not write the GNU variant. It fully supports the BSD variant.
Modifier and Type | Field and Description |
---|---|
static String |
HEADER
The header for each entry
|
static String |
TRAILER
The trailer for each entry
|
SIZE_UNKNOWN
Constructor and Description |
---|
ArArchiveEntry(File inputFile,
String entryName)
Create a new instance using the attributes of the given file
|
ArArchiveEntry(String name,
long length)
Create a new instance using a couple of default values.
|
ArArchiveEntry(String name,
long length,
int userId,
int groupId,
int mode,
long lastModified)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
getGroupId() |
long |
getLastModified()
Last modified time in seconds since the epoch.
|
Date |
getLastModifiedDate()
Gets the last modified date of this entry.
|
long |
getLength() |
int |
getMode() |
String |
getName()
Gets the name of the entry in this archive.
|
long |
getSize()
Gets the uncompressed size of this entry.
|
int |
getUserId() |
int |
hashCode() |
boolean |
isDirectory()
Returns true if this entry refers to a directory.
|
public static final String HEADER
public static final String TRAILER
public ArArchiveEntry(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(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 long getSize()
ArchiveEntry
getSize
in interface ArchiveEntry
public String getName()
ArchiveEntry
getName
in interface ArchiveEntry
public int getUserId()
public int getGroupId()
public int getMode()
public long getLastModified()
public Date getLastModifiedDate()
ArchiveEntry
getLastModifiedDate
in interface ArchiveEntry
public long getLength()
public boolean isDirectory()
ArchiveEntry
isDirectory
in interface ArchiveEntry
Copyright © 2014 The Apache Software Foundation. All rights reserved.