public class JarOutputStream
extends org.apache.tools.zip.ZipOutputStream
Modifier and Type | Field and Description |
---|---|
private boolean |
firstEntry |
private static int |
JAR_MAGIC |
private boolean |
preventClose |
Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
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.
|
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
private static final int JAR_MAGIC
private boolean firstEntry
private boolean preventClose
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 streamjava.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 createdjava.io.IOException
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 writtenZipException
- if a ZIP error has occurredjava.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 interface java.lang.AutoCloseable
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)