|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
org.apache.tools.zip.ZipOutputStream
com.izforge.izpack.util.JarOutputStream
public class JarOutputStream
IzPack will be able to support different compression methods for the packs included in the installation jar file. For this a jar output stream will be needed with which the info data (size, CRC) can be written after the compressed data. This is not possible with the standard class java.util.jar.JarOutputStream. Therefore we create an own class which supports it. Really the hole work will be delegated to the ZipOutputStream from the apache team which solves the problem.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.tools.zip.ZipOutputStream |
---|
org.apache.tools.zip.ZipOutputStream.UnicodeExtraFieldPolicy |
Field Summary | |
---|---|
private boolean |
firstEntry
|
private static int |
JAR_MAGIC
|
private boolean |
preventClose
|
Fields inherited from class org.apache.tools.zip.ZipOutputStream |
---|
buf, CFH_SIG, DD_SIG, def, DEFAULT_COMPRESSION, DEFLATED, EFS_FLAG, EOCD_SIG, LFH_SIG, STORED, UFT8_NAMES_FLAG |
Fields inherited from class java.io.FilterOutputStream |
---|
out |
Constructor Summary | |
---|---|
JarOutputStream(java.io.File arg0)
Creates a new JarOutputStream with no manifest. |
|
JarOutputStream(java.io.File fout,
java.util.jar.Manifest man)
Creates a new JarOutputStream with the specified
Manifest . |
|
JarOutputStream(java.io.OutputStream out)
Creates a new JarOutputStream with no manifest. |
Method Summary | |
---|---|
void |
close()
Closes this output stream and releases any system resources associated with the stream if isPreventClose is not true. |
void |
closeAlways()
Closes this output stream and releases any system resources associated with the stream also isPreventClose is true. |
private static int |
get16(byte[] b,
int off)
|
private static boolean |
hasMagic(byte[] edata)
|
boolean |
isPreventClose()
|
void |
putNextEntry(org.apache.tools.zip.ZipEntry ze)
Begins writing a new JAR file entry and positions the stream to the start of the entry data. |
private static void |
set16(byte[] b,
int off,
int value)
|
void |
setPreventClose(boolean preventClose)
Determine whether a call of the close method will be performed or not. |
Methods inherited from class org.apache.tools.zip.ZipOutputStream |
---|
adjustToLong, closeEntry, deflate, finish, flush, getBytes, getEncoding, isSeekable, setComment, setCreateUnicodeExtraFields, setEncoding, setFallbackToUTF8, setLevel, setMethod, setUseLanguageEncodingFlag, toDosTime, toDosTime, write, write, writeCentralDirectoryEnd, writeCentralFileHeader, writeDataDescriptor, writeLocalFileHeader, writeOut, writeOut |
Methods inherited from class java.io.FilterOutputStream |
---|
write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int JAR_MAGIC
private boolean firstEntry
private boolean preventClose
Constructor Detail |
---|
public JarOutputStream(java.io.OutputStream out) throws java.io.IOException
JarOutputStream
with no manifest.
Using this constructor it will be NOT possible to write
data with compression format STORED to the stream without
declare the info data (size, CRC) at putNextEntry
.
out
- the actual output stream
java.io.IOException
- if an I/O error has occurredpublic JarOutputStream(java.io.File fout, java.util.jar.Manifest man) throws java.io.IOException
JarOutputStream
with the specified
Manifest
. The manifest is written as the first
entry to the output stream which will be created from the
file argument.
fout
- the file object with which the output stream
should be createdman
- the Manifest
java.io.IOException
- if an I/O error has occurredpublic JarOutputStream(java.io.File arg0) throws java.io.IOException
JarOutputStream
with no manifest.
Will use random access if possible.
arg0
- the file object with which the output stream
should be created
java.io.IOException
Method Detail |
---|
public void putNextEntry(org.apache.tools.zip.ZipEntry ze) throws java.io.IOException
putNextEntry
in class org.apache.tools.zip.ZipOutputStream
ze
- the ZIP/JAR entry to be written
ZipException
- if a ZIP error has occurred
java.io.IOException
- if an I/O error has occurredpublic boolean isPreventClose()
public void setPreventClose(boolean preventClose)
preventClose
- The preventClose to set.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class org.apache.tools.zip.ZipOutputStream
java.io.IOException
- if an I/O error occurs.public void closeAlways() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.private static boolean hasMagic(byte[] edata)
private static int get16(byte[] b, int off)
private static void set16(byte[] b, int off, int value)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |