public class Segment extends java.lang.Object
Codec
), it is not possible to calculate the start of the next segment, although one of the header
values does hint at the size of the segment if non-zero, which can be used for buffering purposes.
Note that this does not perform any buffering of the input stream; each value will be read on a byte-by-byte basis.
It does not perform GZip decompression automatically; both of these are expected to be done by the caller if the
stream has the magic header for GZip streams (GZIPInputStream.GZIP_MAGIC
). In any case, if GZip decompression
is being performed the input stream will be buffered at a higher level, and thus this can read on a byte-oriented
basis.Modifier and Type | Field and Description |
---|---|
static int |
LOG_LEVEL_QUIET |
static int |
LOG_LEVEL_STANDARD |
static int |
LOG_LEVEL_VERBOSE |
Constructor and Description |
---|
Segment() |
Modifier and Type | Method and Description |
---|---|
protected AttrDefinitionBands |
getAttrDefinitionBands() |
protected ClassBands |
getClassBands() |
SegmentConstantPool |
getConstantPool() |
protected CpBands |
getCpBands() |
protected IcBands |
getIcBands() |
SegmentHeader |
getSegmentHeader() |
void |
log(int logLevel,
java.lang.String message) |
void |
overrideDeflateHint(boolean deflateHint)
Override the archive's deflate hint with the given boolean
|
void |
setLogLevel(int logLevel) |
void |
setLogStream(java.io.OutputStream logStream) |
void |
setPreRead(boolean value) |
void |
unpack(java.io.InputStream in,
java.util.jar.JarOutputStream out)
Unpacks a packed stream (either .pack.
|
void |
writeJar(java.util.jar.JarOutputStream out)
Writes the segment to an output stream.
|
public static final int LOG_LEVEL_VERBOSE
public static final int LOG_LEVEL_STANDARD
public static final int LOG_LEVEL_QUIET
public Segment()
public void unpack(java.io.InputStream in, java.util.jar.JarOutputStream out) throws java.io.IOException, Pack200Exception
in
- a packed stream.out
- output stream.Pack200Exception
- if there is a problem unpackingjava.io.IOException
- if there is a problem with I/O during unpackingpublic void writeJar(java.util.jar.JarOutputStream out) throws java.io.IOException, Pack200Exception
out
- the JarOutputStream to write data tojava.io.IOException
- if an error occurs while reading or writing to the streamsPack200Exception
- if an error occurs while processing datapublic SegmentConstantPool getConstantPool()
public SegmentHeader getSegmentHeader()
public void setPreRead(boolean value)
protected AttrDefinitionBands getAttrDefinitionBands()
protected ClassBands getClassBands()
protected CpBands getCpBands()
protected IcBands getIcBands()
public void setLogLevel(int logLevel)
public void setLogStream(java.io.OutputStream logStream)
public void log(int logLevel, java.lang.String message)
public void overrideDeflateHint(boolean deflateHint)
deflateHint
- - the deflate hint to use