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 |
buf, CFH_SIG, DD_SIG, def, DEFLATED, EOCD_SIG, LFH_SIG, STORED
out
Constructor and Description |
---|
JarOutputStream(File arg0)
Creates a new
JarOutputStream with no manifest. |
JarOutputStream(File fout,
Manifest man)
Creates a new
JarOutputStream with the specified
Manifest . |
JarOutputStream(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.
|
closeEntry, deflate, finish, flush, getBytes, getEncoding, isSeekable, setComment, setEncoding, setLevel, setMethod, toDosTime, write, write, writeCentralDirectoryEnd, writeCentralFileHeader, writeDataDescriptor, writeLocalFileHeader, writeOut, writeOut
write
private static final int JAR_MAGIC
private boolean firstEntry
private boolean preventClose
public JarOutputStream(OutputStream out) throws 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 streamIOException
- if an I/O error has occurredpublic JarOutputStream(File fout, Manifest man) throws 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
IOException
- if an I/O error has occurredpublic JarOutputStream(File arg0) throws IOException
JarOutputStream
with no manifest.
Will use random access if possible.arg0
- the file object with which the output stream
should be createdIOException
public void putNextEntry(org.apache.tools.zip.ZipEntry ze) throws IOException
putNextEntry
in class org.apache.tools.zip.ZipOutputStream
ze
- the ZIP/JAR entry to be writtenZipException
- if a ZIP error has occurredIOException
- if an I/O error has occurredpublic boolean isPreventClose()
public void setPreventClose(boolean preventClose)
preventClose
- The preventClose to set.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class org.apache.tools.zip.ZipOutputStream
IOException
- if an I/O error occurs.public void closeAlways() throws IOException
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)
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses