Top Description Fields Constructors Methods
org.apache.tools.tar

public Class TarEntry

extends Object
implements TarConstants
Class Inheritance
All Implemented Interfaces
org.apache.tools.tar.TarConstants
Imports
java.io.File, .IOException, java.nio.charset.StandardCharsets, java.util.Date, .Locale, org.apache.tools.zip.ZipEncoding

This class represents an entry in a Tar archive. It consists of the entry's header, as well as the entry's File. Entries can be instantiated in one of three ways, depending on how they are to be used.

TarEntries that are created from the header bytes read from an archive are instantiated with the TarEntry(byte[]) constructor. These entries will be used when extracting from or listing the contents of an archive. These entries have their header filled in using the header bytes. They also set the File to null, since they reference an archive entry not a file.

TarEntries that are created from Files that are to be written into an archive are instantiated with the TarEntry(File) constructor. These entries have their header filled in using the File's information. They also keep a reference to the File for convenience when writing entries.

Finally, TarEntries can be constructed from nothing but a name. This allows the programmer to construct the entry by hand, for instance when only an InputStream is available for writing to the archive, and the header information is constructed from other information. In this case the header fields are set to defaults and the File is set to null.

The C structure for a Tar Entry's header is:
struct header {
char name[NAMSIZ];
char mode[8];
char uid[8];
char gid[8];
char size[12];
char mtime[12];
char chksum[8];
char linkflag;
char linkname[NAMSIZ];
char magic[8];
char uname[TUNMLEN];
char gname[TGNMLEN];
char devmajor[8];
char devminor[8];
} header;
All unused bytes are set to null.
New-style GNU tar files are slightly different from the above.
For values of size larger than 077777777777L (11 7s)
or uid and gid larger than 07777777L (7 7s)
the sign bit of the first byte is set, and the rest of the
field is the binary representation of the number.
See TarUtils.parseOctalOrBinary.
The C structure for a old GNU Tar Entry's header is:
struct oldgnu_header {
char unused_pad1[345]; // TarConstants.PAD1LEN_GNU       - offset 0
char atime[12];        // TarConstants.ATIMELEN_GNU      - offset 345
char ctime[12];        // TarConstants.CTIMELEN_GNU      - offset 357
char offset[12];       // TarConstants.OFFSETLEN_GNU     - offset 369
char longnames[4];     // TarConstants.LONGNAMESLEN_GNU  - offset 381
char unused_pad2;      // TarConstants.PAD2LEN_GNU       - offset 385
struct sparse sp[4];   // TarConstants.SPARSELEN_GNU     - offset 386
char isextended;       // TarConstants.ISEXTENDEDLEN_GNU - offset 482
char realsize[12];     // TarConstants.REALSIZELEN_GNU   - offset 483
char unused_pad[17];   // TarConstants.PAD3LEN_GNU       - offset 495
};
Whereas, "struct sparse" is:
struct sparse {
char offset[12];   // offset 0
char numbytes[12]; // offset 12
};

Field Summary

Modifier and TypeField and Description
public static final int
DEFAULT_DIR_MODE

Default permissions bits for directories

public static final int
DEFAULT_FILE_MODE

Default permissions bits for files

private int
devMajor

The entry's major device number.

private int
devMinor

The entry's minor device number.

private File
file

The entry's file reference

private long
groupId

The entry's group id.

private String
groupName

The entry's group name.

private boolean
isExtended

If an extension sparse header follows.

private byte
linkFlag

The entry's link flag.

private String
linkName

The entry's link name.

private String
magic

The entry's magic tag.

public static final int
MAX_NAMELEN

Maximum length of a user's name in the tar file

public static final int
MILLIS_PER_SECOND

Convert millis to seconds

private int
mode

The entry's permission mode.

private long
modTime

The entry's modification time.

private String
name

The entry's name.

private long
realSize

The entry's real size in case of a sparse file.

private long
size

The entry's size.

private long
userId

The entry's user id.

private String
userName

The entry's user name.

private String
version

The version of the format

Constructor Summary

AccessConstructor and Description
private
TarEntry()

Construct an empty entry and prepares the header values.

public
TarEntry(String
the entry name
name
)

Construct an entry with only a name.

public
TarEntry(String
the entry name
name
,
boolean
whether to allow leading slashes in the name.
preserveLeadingSlashes
)

Construct an entry with only a name.

public
TarEntry(String
the entry name
name
,
byte
the entry link flag.
linkFlag
)

Construct an entry with a name and a link flag.

public
TarEntry(File
The file that the entry represents.
file
)

Construct an entry for a file.

public
TarEntry(File
The file that the entry represents.
file
,
String
the name to be used for the entry.
fileName
)

Construct an entry for a file.

public
TarEntry(byte[]
The header bytes from a tar archive entry.
headerBuf
)

Construct an entry from an archive's header bytes.

public
TarEntry(byte[]
The header bytes from a tar archive entry.
headerBuf
,
ZipEncoding
encoding to use for file names
encoding
)

Construct an entry from an archive's header bytes.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

True if the entries are equal.
equals
(TarEntry
Entry to be checked for equality.
it
)

Determine if the two entries are equal.

public boolean

Returns:

True if the entries are equal.
equals
(Object
Entry to be checked for equality.
it
)

Overrides java.lang.Object.equals.

Determine if the two entries are equal.
private int

Returns:

format type
evaluateType
(byte[]
The tar entry header buffer to evaluate the format for.
header
)

Evaluate an entry's header format from a header buffer.

public int

Returns:

This entry's major device number.
getDevMajor
()

Get this entry's major device number.

public int

Returns:

This entry's minor device number.
getDevMinor
()

Get this entry's minor device number.

public TarEntry[]

Returns:

An array of TarEntry's for this entry's children.
getDirectoryEntries
()

If this entry represents a file, and the file is a directory, return an array of TarEntries for this entry's children.

public File

Returns:

This entry's file.
getFile
()

Get this entry's file.

public int

Returns:

This entry's group id.
getGroupId
()

Deprecated use #getLongGroupId instead as group ids can be bigger than Integer#MAX_VALUE
Get this entry's group id.
public String

Returns:

This entry's group name.
getGroupName
()

Get this entry's group name.

public byte

Returns:

This entry's link flag.
getLinkFlag
()

Get this entry's link flag.

public String

Returns:

This entry's link name.
getLinkName
()

Get this entry's link name.

public long

Returns:

This entry's group id.
getLongGroupId
()

Get this entry's group id.

public long

Returns:

This entry's user id.
getLongUserId
()

Get this entry's user id.

public int

Returns:

This entry's mode.
getMode
()

Get this entry's mode.

public Date

Returns:

time This entry's new modification time.
getModTime
()

Set this entry's modification time.

public String

Returns:

This entry's name.
getName
()

Get this entry's name.

public long

Returns:

This entry's real file size.
getRealSize
()

Get this entry's real file size in case of a sparse file.

public long

Returns:

This entry's file size.
getSize
()

Get this entry's file size.

public int

Returns:

This entry's user id.
getUserId
()

Deprecated use #getLongUserId instead as user ids can be bigger than Integer#MAX_VALUE
Get this entry's user id.
public String

Returns:

This entry's user name.
getUserName
()

Get this entry's user name.

public int

Returns:

the entry hashcode
hashCode
()

Overrides java.lang.Object.hashCode.

Hashcodes are based on entry names.
public boolean

Returns:

true if this is a block device entry.
isBlockDevice
()

public boolean

Returns:

true if it is a character device entry
isCharacterDevice
()

Check if this is a character device entry.

public boolean

Returns:

True if entry is a descendant of this.
isDescendent
(TarEntry
Entry to be checked as a descendant of this.
desc
)

Determine if the given entry is a descendant of this entry.

public boolean

Returns:

True if this entry is a directory.
isDirectory
()

Return whether or not this entry represents a directory.

private static boolean

Returns:

true if buffer1 and buffer2 have same contents, having regard to trailing nulls
isEqual
(final byte[]
byte[]
buffer1
,
final int
int
offset1
,
final int
int
length1
,
final byte[]
byte[]
buffer2
,
final int
int
offset2
,
final int
int
length2
,
boolean
boolean
ignoreTrailingNulls
)

Compare byte buffers, optionally ignoring trailing nulls

public boolean

Returns:

true if an extension sparse header follows.
isExtended
()

Indicates in case of a sparse file if an extension sparse header follows.

public boolean

Returns:

true if this is a FIFO (pipe) entry.
isFIFO
()

public boolean

Returns:

true if it is a 'normal' file
isFile
()

Check if this is a "normal file".

public boolean

Returns:

true if this is a Pax header.
isGlobalPaxHeader
()

Check if this is a Pax header.

public boolean

Returns:

true if this is a long name extension provided by GNU tar
isGNULongLinkEntry
()

Indicate if this entry is a GNU long linkname block

public boolean

Returns:

true if this is a long name extension provided by GNU tar
isGNULongNameEntry
()

Indicate if this entry is a GNU long name block

public boolean

Returns:

true if this is a sparse extension provided by GNU tar
isGNUSparse
()

Indicate if this entry is a GNU sparse block.

public boolean

Returns:

true if this is a Pax header.
isPaxHeader
()

Check if this is a Pax header.

private static boolean

Returns:

true if buffer is the same as the expected string
matchAsciiBuffer
(String
String
expected
,
byte[]
byte[]
buffer
,
int
int
offset
,
int
int
length
)

Check if buffer contents matches Ascii String.

private static String
normalizeFileName(String fileName, boolean preserveLeadingSlashes)

Strips Windows' drive letter as well as any leading slashes, turns path separators into forward slashes.

public void
parseTarHeader(byte[]
The tar entry header buffer to get information from.
header
)

Parse an entry's header information from a header buffer.

public void
parseTarHeader(byte[]
The tar entry header buffer to get information from.
header
,
ZipEncoding
encoding to use for file names
encoding
)

Parse an entry's header information from a header buffer.

private void
parseTarHeader(byte[] header, ZipEncoding encoding, final boolean oldStyle)

public void
setDevMajor(int
This entry's major device number.
devNo
)

Set this entry's major device number.

public void
setDevMinor(int
This entry's minor device number.
devNo
)

Set this entry's minor device number.

public void
setGroupId(int
This entry's new group id.
groupId
)

Set this entry's group id.

public void
setGroupId(long
This entry's new group id.
groupId
)

Set this entry's group id.

public void
setGroupName(String
This entry's new group name.
groupName
)

Set this entry's group name.

public void
setIds(int
This entry's new user id.
userId
,
int
This entry's new group id.
groupId
)

Convenience method to set this entry's group and user ids.

public void
setLinkFlag(byte
the link flag to use.
linkFlag
)

Set this entry's link flag.

public void
setLinkName(String
the link name to use.
link
)

Set this entry's link name.

public void
setMode(int
the mode for this entry
mode
)

Set the mode for this entry

public void
setModTime(long
This entry's new modification time.
time
)

Set this entry's modification time.

public void
setModTime(Date
This entry's new modification time.
time
)

Set this entry's modification time.

public void
setName(String
This entry's new name.
name
)

Set this entry's name.

public void
setNames(String
This entry's new user name.
userName
,
String
This entry's new group name.
groupName
)

Convenience method to set this entry's group and user names.

public void
setSize(long
This entry's new file size.
size
)

Set this entry's file size.

public void
setUserId(int
This entry's new user id.
userId
)

Set this entry's user id.

public void
setUserId(long
This entry's new user id.
userId
)

Set this entry's user id.

public void
setUserName(String
This entry's new user name.
userName
)

Set this entry's user name.

public void
writeEntryHeader(byte[]
The tar entry header buffer to fill in.
outbuf
)

Write an entry's header information to a header buffer.

public void
writeEntryHeader(byte[]
The tar entry header buffer to fill in.
outbuf
,
ZipEncoding
encoding to use when writing the file name.
encoding
,
boolean
whether to use the star/GNU tar/BSD tar extension for numeric fields if their value doesn't fit in the maximum size of standard tar archives
starMode
)

Write an entry's header information to a header buffer.

private int
writeEntryHeaderField(long value, byte[] outbuf, int offset, int length, boolean starMode)

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_DIR_MODEback to summary
public static final int DEFAULT_DIR_MODE

Default permissions bits for directories

DEFAULT_FILE_MODEback to summary
public static final int DEFAULT_FILE_MODE

Default permissions bits for files

devMajorback to summary
private int devMajor

The entry's major device number.

devMinorback to summary
private int devMinor

The entry's minor device number.

fileback to summary
private File file

The entry's file reference

groupIdback to summary
private long groupId

The entry's group id.

groupNameback to summary
private String groupName

The entry's group name.

isExtendedback to summary
private boolean isExtended

If an extension sparse header follows.

linkFlagback to summary
private byte linkFlag

The entry's link flag.

linkNameback to summary
private String linkName

The entry's link name.

magicback to summary
private String magic

The entry's magic tag.

MAX_NAMELENback to summary
public static final int MAX_NAMELEN

Maximum length of a user's name in the tar file

MILLIS_PER_SECONDback to summary
public static final int MILLIS_PER_SECOND

Convert millis to seconds

modeback to summary
private int mode

The entry's permission mode.

modTimeback to summary
private long modTime

The entry's modification time.

nameback to summary
private String name

The entry's name.

realSizeback to summary
private long realSize

The entry's real size in case of a sparse file.

sizeback to summary
private long size

The entry's size.

userIdback to summary
private long userId

The entry's user id.

userNameback to summary
private String userName

The entry's user name.

versionback to summary
private String version

The version of the format

Constructor Detail

TarEntryback to summary
private TarEntry()

Construct an empty entry and prepares the header values.

TarEntryback to summary
public TarEntry(String name)

Construct an entry with only a name. This allows the programmer to construct the entry's header "by hand". File is set to null.

Parameters
name:String

the entry name

TarEntryback to summary
public TarEntry(String name, boolean preserveLeadingSlashes)

Construct an entry with only a name. This allows the programmer to construct the entry's header "by hand". File is set to null.

Parameters
name:String

the entry name

preserveLeadingSlashes:boolean

whether to allow leading slashes in the name.

TarEntryback to summary
public TarEntry(String name, byte linkFlag)

Construct an entry with a name and a link flag.

Parameters
name:String

the entry name

linkFlag:byte

the entry link flag.

TarEntryback to summary
public TarEntry(File file)

Construct an entry for a file. File is set to file, and the header is constructed from information from the file. The name is set from the normalized file path.

Parameters
file:File

The file that the entry represents.

TarEntryback to summary
public TarEntry(File file, String fileName)

Construct an entry for a file. File is set to file, and the header is constructed from information from the file.

Parameters
file:File

The file that the entry represents.

fileName:String

the name to be used for the entry.

TarEntryback to summary
public TarEntry(byte[] headerBuf)

Construct an entry from an archive's header bytes. File is set to null.

Parameters
headerBuf:byte[]

The header bytes from a tar archive entry.

Exceptions
IllegalArgumentException:
if any of the numeric fields have an invalid format
TarEntryback to summary
public TarEntry(byte[] headerBuf, ZipEncoding encoding) throws IOException

Construct an entry from an archive's header bytes. File is set to null.

Parameters
headerBuf:byte[]

The header bytes from a tar archive entry.

encoding:ZipEncoding

encoding to use for file names

Exceptions
IOException:
if an error occurs during reading the archive
IllegalArgumentException:
if any of the numeric fields have an invalid format

Method Detail

equalsback to summary
public boolean equals(TarEntry it)

Determine if the two entries are equal. Equality is determined by the header names being equal.

Parameters
it:TarEntry

Entry to be checked for equality.

Returns:boolean

True if the entries are equal.

equalsback to summary
public boolean equals(Object it)

Overrides java.lang.Object.equals.

Determine if the two entries are equal. Equality is determined by the header names being equal.

Parameters
it:Object

Entry to be checked for equality.

Returns:boolean

True if the entries are equal.

Annotations
@Override
evaluateTypeback to summary
private int evaluateType(byte[] header)

Evaluate an entry's header format from a header buffer.

Parameters
header:byte[]

The tar entry header buffer to evaluate the format for.

Returns:int

format type

getDevMajorback to summary
public int getDevMajor()

Get this entry's major device number.

Returns:int

This entry's major device number.

getDevMinorback to summary
public int getDevMinor()

Get this entry's minor device number.

Returns:int

This entry's minor device number.

getDirectoryEntriesback to summary
public TarEntry[] getDirectoryEntries()

If this entry represents a file, and the file is a directory, return an array of TarEntries for this entry's children.

Returns:TarEntry[]

An array of TarEntry's for this entry's children.

getFileback to summary
public File getFile()

Get this entry's file.

Returns:File

This entry's file.

getGroupIdback to summary
public int getGroupId()

Deprecated

use #getLongGroupId instead as group ids can be bigger than Integer#MAX_VALUE

Get this entry's group id.

Returns:int

This entry's group id.

Annotations
@Deprecated
getGroupNameback to summary
public String getGroupName()

Get this entry's group name.

Returns:String

This entry's group name.

getLinkFlagback to summary
public byte getLinkFlag()

Get this entry's link flag.

Returns:byte

This entry's link flag.

Since
1.10.12
getLinkNameback to summary
public String getLinkName()

Get this entry's link name.

Returns:String

This entry's link name.

getLongGroupIdback to summary
public long getLongGroupId()

Get this entry's group id.

Returns:long

This entry's group id.

Since
1.9.5
getLongUserIdback to summary
public long getLongUserId()

Get this entry's user id.

Returns:long

This entry's user id.

Since
1.9.5
getModeback to summary
public int getMode()

Get this entry's mode.

Returns:int

This entry's mode.

getModTimeback to summary
public Date getModTime()

Set this entry's modification time.

Returns:Date

time This entry's new modification time.

getNameback to summary
public String getName()

Get this entry's name.

Returns:String

This entry's name.

getRealSizeback to summary
public long getRealSize()

Get this entry's real file size in case of a sparse file.

Returns:long

This entry's real file size.

getSizeback to summary
public long getSize()

Get this entry's file size.

Returns:long

This entry's file size.

getUserIdback to summary
public int getUserId()

Deprecated

use #getLongUserId instead as user ids can be bigger than Integer#MAX_VALUE

Get this entry's user id.

Returns:int

This entry's user id.

Annotations
@Deprecated
getUserNameback to summary
public String getUserName()

Get this entry's user name.

Returns:String

This entry's user name.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Hashcodes are based on entry names.

Returns:int

the entry hashcode

Annotations
@Override
isBlockDeviceback to summary
public boolean isBlockDevice()
Returns:boolean

true if this is a block device entry.

isCharacterDeviceback to summary
public boolean isCharacterDevice()

Check if this is a character device entry.

Returns:boolean

true if it is a character device entry

isDescendentback to summary
public boolean isDescendent(TarEntry desc)

Determine if the given entry is a descendant of this entry. Descendancy is determined by the name of the descendant starting with this entry's name.

Parameters
desc:TarEntry

Entry to be checked as a descendant of this.

Returns:boolean

True if entry is a descendant of this.

isDirectoryback to summary
public boolean isDirectory()

Return whether or not this entry represents a directory.

Returns:boolean

True if this entry is a directory.

isEqualback to summary
private static boolean isEqual(final byte[] buffer1, final int offset1, final int length1, final byte[] buffer2, final int offset2, final int length2, boolean ignoreTrailingNulls)

Compare byte buffers, optionally ignoring trailing nulls

Parameters
buffer1:byte[]

byte[]

offset1:int

int

length1:int

int

buffer2:byte[]

byte[]

offset2:int

int

length2:int

int

ignoreTrailingNulls:boolean

boolean

Returns:boolean

true if buffer1 and buffer2 have same contents, having regard to trailing nulls

isExtendedback to summary
public boolean isExtended()

Indicates in case of a sparse file if an extension sparse header follows.

Returns:boolean

true if an extension sparse header follows.

isFIFOback to summary
public boolean isFIFO()
Returns:boolean

true if this is a FIFO (pipe) entry.

isFileback to summary
public boolean isFile()

Check if this is a "normal file".

Returns:boolean

true if it is a 'normal' file

isGlobalPaxHeaderback to summary
public boolean isGlobalPaxHeader()

Check if this is a Pax header.

Returns:boolean

true if this is a Pax header.

isGNULongLinkEntryback to summary
public boolean isGNULongLinkEntry()

Indicate if this entry is a GNU long linkname block

Returns:boolean

true if this is a long name extension provided by GNU tar

isGNULongNameEntryback to summary
public boolean isGNULongNameEntry()

Indicate if this entry is a GNU long name block

Returns:boolean

true if this is a long name extension provided by GNU tar

isGNUSparseback to summary
public boolean isGNUSparse()

Indicate if this entry is a GNU sparse block.

Returns:boolean

true if this is a sparse extension provided by GNU tar

isPaxHeaderback to summary
public boolean isPaxHeader()

Check if this is a Pax header.

Returns:boolean

true if this is a Pax header.

matchAsciiBufferback to summary
private static boolean matchAsciiBuffer(String expected, byte[] buffer, int offset, int length)

Check if buffer contents matches Ascii String.

Parameters
expected:String

String

buffer:byte[]

byte[]

offset:int

int

length:int

int

Returns:boolean

true if buffer is the same as the expected string

normalizeFileNameback to summary
private static String normalizeFileName(String fileName, boolean preserveLeadingSlashes)

Strips Windows' drive letter as well as any leading slashes, turns path separators into forward slashes.

parseTarHeaderback to summary
public void parseTarHeader(byte[] header)

Parse an entry's header information from a header buffer.

Parameters
header:byte[]

The tar entry header buffer to get information from.

Exceptions
IllegalArgumentException:
if any of the numeric fields have an invalid format
parseTarHeaderback to summary
public void parseTarHeader(byte[] header, ZipEncoding encoding) throws IOException

Parse an entry's header information from a header buffer.

Parameters
header:byte[]

The tar entry header buffer to get information from.

encoding:ZipEncoding

encoding to use for file names

Exceptions
IOException:
if an error occurs while reading the archive
IllegalArgumentException:
if any of the numeric fields have an invalid format
parseTarHeaderback to summary
private void parseTarHeader(byte[] header, ZipEncoding encoding, final boolean oldStyle) throws IOException
setDevMajorback to summary
public void setDevMajor(int devNo)

Set this entry's major device number.

Parameters
devNo:int

This entry's major device number.

Exceptions
IllegalArgumentException:
if the devNo is < 0.
setDevMinorback to summary
public void setDevMinor(int devNo)

Set this entry's minor device number.

Parameters
devNo:int

This entry's minor device number.

Exceptions
IllegalArgumentException:
if the devNo is < 0.
setGroupIdback to summary
public void setGroupId(int groupId)

Set this entry's group id.

Parameters
groupId:int

This entry's new group id.

setGroupIdback to summary
public void setGroupId(long groupId)

Set this entry's group id.

Parameters
groupId:long

This entry's new group id.

Since
1.9.5
setGroupNameback to summary
public void setGroupName(String groupName)

Set this entry's group name.

Parameters
groupName:String

This entry's new group name.

setIdsback to summary
public void setIds(int userId, int groupId)

Convenience method to set this entry's group and user ids.

Parameters
userId:int

This entry's new user id.

groupId:int

This entry's new group id.

setLinkFlagback to summary
public void setLinkFlag(byte linkFlag)

Set this entry's link flag.

Parameters
linkFlag:byte

the link flag to use.

Since
1.10.12
setLinkNameback to summary
public void setLinkName(String link)

Set this entry's link name.

Parameters
link:String

the link name to use.

setModeback to summary
public void setMode(int mode)

Set the mode for this entry

Parameters
mode:int

the mode for this entry

setModTimeback to summary
public void setModTime(long time)

Set this entry's modification time. The parameter passed to this method is in "Java time".

Parameters
time:long

This entry's new modification time.

setModTimeback to summary
public void setModTime(Date time)

Set this entry's modification time.

Parameters
time:Date

This entry's new modification time.

setNameback to summary
public void setName(String name)

Set this entry's name.

Parameters
name:String

This entry's new name.

setNamesback to summary
public void setNames(String userName, String groupName)

Convenience method to set this entry's group and user names.

Parameters
userName:String

This entry's new user name.

groupName:String

This entry's new group name.

setSizeback to summary
public void setSize(long size)

Set this entry's file size.

Parameters
size:long

This entry's new file size.

Exceptions
IllegalArgumentException:
if the size is < 0.
setUserIdback to summary
public void setUserId(int userId)

Set this entry's user id.

Parameters
userId:int

This entry's new user id.

setUserIdback to summary
public void setUserId(long userId)

Set this entry's user id.

Parameters
userId:long

This entry's new user id.

Since
1.9.5
setUserNameback to summary
public void setUserName(String userName)

Set this entry's user name.

Parameters
userName:String

This entry's new user name.

writeEntryHeaderback to summary
public void writeEntryHeader(byte[] outbuf)

Write an entry's header information to a header buffer.

This method does not use the star/GNU tar/BSD tar extensions.

Parameters
outbuf:byte[]

The tar entry header buffer to fill in.

writeEntryHeaderback to summary
public void writeEntryHeader(byte[] outbuf, ZipEncoding encoding, boolean starMode) throws IOException

Write an entry's header information to a header buffer.

Parameters
outbuf:byte[]

The tar entry header buffer to fill in.

encoding:ZipEncoding

encoding to use when writing the file name.

starMode:boolean

whether to use the star/GNU tar/BSD tar extension for numeric fields if their value doesn't fit in the maximum size of standard tar archives

Exceptions
IOException:
if an error occurs while writing the archive
writeEntryHeaderFieldback to summary
private int writeEntryHeaderField(long value, byte[] outbuf, int offset, int length, boolean starMode)