org.apache.commons.compress.archivers.zip
Class JarMarker

java.lang.Object
  extended by org.apache.commons.compress.archivers.zip.JarMarker
All Implemented Interfaces:
ZipExtraField

public final class JarMarker
extends Object
implements ZipExtraField

If this extra field is added as the very first extra field of the archive, Solaris will consider it an executable jar file.

This class is immutable

Constructor Summary
JarMarker()
          No-arg constructor
 
Method Summary
 byte[] getCentralDirectoryData()
          The actual data to put central directory - without Header-ID or length specifier.
 ZipShort getCentralDirectoryLength()
          Length of the extra field in the central directory - without Header-ID or length specifier.
 ZipShort getHeaderId()
          The Header-ID.
static JarMarker getInstance()
          Since JarMarker is stateless we can always use the same instance.
 byte[] getLocalFileDataData()
          The actual data to put into local file data - without Header-ID or length specifier.
 ZipShort getLocalFileDataLength()
          Length of the extra field in the local file data - without Header-ID or length specifier.
 void parseFromCentralDirectoryData(byte[] buffer, int offset, int length)
          Doesn't do anything special since this class always uses the same data in central directory and local file data.
 void parseFromLocalFileData(byte[] data, int offset, int length)
          Populate data from this array as if it was in local file data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarMarker

public JarMarker()
No-arg constructor

Method Detail

getInstance

public static JarMarker getInstance()
Since JarMarker is stateless we can always use the same instance.

Returns:
the DEFAULT jarmaker.

getHeaderId

public ZipShort getHeaderId()
The Header-ID.

Specified by:
getHeaderId in interface ZipExtraField
Returns:
the header id

getLocalFileDataLength

public ZipShort getLocalFileDataLength()
Length of the extra field in the local file data - without Header-ID or length specifier.

Specified by:
getLocalFileDataLength in interface ZipExtraField
Returns:
0

getCentralDirectoryLength

public ZipShort getCentralDirectoryLength()
Length of the extra field in the central directory - without Header-ID or length specifier.

Specified by:
getCentralDirectoryLength in interface ZipExtraField
Returns:
0

getLocalFileDataData

public byte[] getLocalFileDataData()
The actual data to put into local file data - without Header-ID or length specifier.

Specified by:
getLocalFileDataData in interface ZipExtraField
Returns:
the data

getCentralDirectoryData

public byte[] getCentralDirectoryData()
The actual data to put central directory - without Header-ID or length specifier.

Specified by:
getCentralDirectoryData in interface ZipExtraField
Returns:
the data

parseFromLocalFileData

public void parseFromLocalFileData(byte[] data,
                                   int offset,
                                   int length)
                            throws ZipException
Populate data from this array as if it was in local file data.

Specified by:
parseFromLocalFileData in interface ZipExtraField
Parameters:
data - an array of bytes
offset - the start offset
length - the number of bytes in the array from offset
Throws:
ZipException - on error

parseFromCentralDirectoryData

public void parseFromCentralDirectoryData(byte[] buffer,
                                          int offset,
                                          int length)
                                   throws ZipException
Doesn't do anything special since this class always uses the same data in central directory and local file data.

Specified by:
parseFromCentralDirectoryData in interface ZipExtraField
Parameters:
buffer - the buffer to read data from
offset - offset into buffer to read data
length - the length of data
Throws:
ZipException - on error


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.