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

public abstract Class AbstractUnicodeExtraField

extends Object
implements ZipExtraField
Class Inheritance
All Implemented Interfaces
org.apache.tools.zip.ZipExtraField
Known Direct Subclasses
org.apache.tools.zip.UnicodeCommentExtraField, org.apache.tools.zip.UnicodePathExtraField
Imports
java.nio.charset.StandardCharsets, java.util.zip.CRC32, .ZipException

A common base class for Unicode extra information extra fields.

Field Summary

Modifier and TypeField and Description
private byte[]
private long
private byte[]

Constructor Summary

AccessConstructor and Description
protected
protected
AbstractUnicodeExtraField(final String
The file name or comment.
text
,
final byte[]
The encoded of the filename or comment in the zip file.
bytes
,
final int
The offset of the encoded filename or comment in bytes.
off
,
final int
The length of the encoded filename or comment in bytes.
len
)

Assemble as unicode extension from the name/comment and encoding of the original zip entry.

protected
AbstractUnicodeExtraField(final String
The file name or comment.
text
,
final byte[]
The encoded of the filename or comment in the zip file.
bytes
)

Assemble as unicode extension from the name/comment and encoding of the original zip entry.

Method Summary

Modifier and TypeMethod and Description
private void
public byte[]
getCentralDirectoryData()

Implements org.apache.tools.zip.ZipExtraField.getCentralDirectoryData.

The actual data to put into central directory - without Header-ID or length specifier.
public ZipShort
getCentralDirectoryLength()

Implements org.apache.tools.zip.ZipExtraField.getCentralDirectoryLength.

Length of the extra field in the central directory - without Header-ID or length specifier.
public byte[]
getLocalFileDataData()

Implements org.apache.tools.zip.ZipExtraField.getLocalFileDataData.

The actual data to put into local file data - without Header-ID or length specifier.
public ZipShort
getLocalFileDataLength()

Implements org.apache.tools.zip.ZipExtraField.getLocalFileDataLength.

Length of the extra field in the local file data - without Header-ID or length specifier.
public long

Returns:

The CRC32 checksum of the filename or comment as encoded in the central directory of the zip file.
getNameCRC32
()

public byte[]

Returns:

The utf-8 encoded name.
getUnicodeName
()

public void
parseFromLocalFileData(final byte[]
an array of bytes
buffer
,
final int
the start offset
offset
,
final int
the number of bytes in the array from offset
length
)

Implements org.apache.tools.zip.ZipExtraField.parseFromLocalFileData.

Populate data from this array as if it was in local file data.
public void
setNameCRC32(final long
The CRC32 checksum of the filename as encoded in the central directory of the zip file to set.
nameCRC32
)

public void
setUnicodeName(final byte[]
The utf-8 encoded name to set.
unicodeName
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
private byte[] data
nameCRC32back to summary
private long nameCRC32
unicodeNameback to summary
private byte[] unicodeName

Constructor Detail

AbstractUnicodeExtraFieldback to summary
protected AbstractUnicodeExtraField()
AbstractUnicodeExtraFieldback to summary
protected AbstractUnicodeExtraField(final String text, final byte[] bytes, final int off, final int len)

Assemble as unicode extension from the name/comment and encoding of the original zip entry.

Parameters
text:String

The file name or comment.

bytes:byte[]

The encoded of the filename or comment in the zip file.

off:int

The offset of the encoded filename or comment in bytes.

len:int

The length of the encoded filename or comment in bytes.

AbstractUnicodeExtraFieldback to summary
protected AbstractUnicodeExtraField(final String text, final byte[] bytes)

Assemble as unicode extension from the name/comment and encoding of the original zip entry.

Parameters
text:String

The file name or comment.

bytes:byte[]

The encoded of the filename or comment in the zip file.

Method Detail

assembleDataback to summary
private void assembleData()
getCentralDirectoryDataback to summary
public byte[] getCentralDirectoryData()

Implements org.apache.tools.zip.ZipExtraField.getCentralDirectoryData.

Doc from org.apache.tools.zip.ZipExtraField.getCentralDirectoryData.

The actual data to put into central directory - without Header-ID or length specifier.

Returns:byte[]

the data

getCentralDirectoryLengthback to summary
public ZipShort getCentralDirectoryLength()

Implements org.apache.tools.zip.ZipExtraField.getCentralDirectoryLength.

Doc from org.apache.tools.zip.ZipExtraField.getCentralDirectoryLength.

Length of the extra field in the central directory - without Header-ID or length specifier.

Returns:ZipShort

the length of the field in the central directory

getLocalFileDataDataback to summary
public byte[] getLocalFileDataData()

Implements org.apache.tools.zip.ZipExtraField.getLocalFileDataData.

Doc from org.apache.tools.zip.ZipExtraField.getLocalFileDataData.

The actual data to put into local file data - without Header-ID or length specifier.

Returns:byte[]

the data

getLocalFileDataLengthback to summary
public ZipShort getLocalFileDataLength()

Implements org.apache.tools.zip.ZipExtraField.getLocalFileDataLength.

Doc from org.apache.tools.zip.ZipExtraField.getLocalFileDataLength.

Length of the extra field in the local file data - without Header-ID or length specifier.

Returns:ZipShort

the length of the field in the local file data

getNameCRC32back to summary
public long getNameCRC32()
Returns:long

The CRC32 checksum of the filename or comment as encoded in the central directory of the zip file.

getUnicodeNameback to summary
public byte[] getUnicodeName()
Returns:byte[]

The utf-8 encoded name.

parseFromLocalFileDataback to summary
public void parseFromLocalFileData(final byte[] buffer, final int offset, final int length) throws ZipException

Implements org.apache.tools.zip.ZipExtraField.parseFromLocalFileData.

Doc from org.apache.tools.zip.ZipExtraField.parseFromLocalFileData.

Populate data from this array as if it was in local file data.

Parameters
buffer:byte[]

an array of bytes

offset:int

the start offset

length:int

the number of bytes in the array from offset

Exceptions
ZipException:
on error
setNameCRC32back to summary
public void setNameCRC32(final long nameCRC32)
Parameters
nameCRC32:long

The CRC32 checksum of the filename as encoded in the central directory of the zip file to set.

setUnicodeNameback to summary
public void setUnicodeName(final byte[] unicodeName)
Parameters
unicodeName:byte[]

The utf-8 encoded name to set.