Java Doc for ZipOutputStream.java in  » IDE » tIDE » org » apache » tools » zip » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE » tIDE » org.apache.tools.zip 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.io.OutputStream
      java.io.FilterOutputStream
         org.apache.tools.zip.ZipOutputStream

ZipOutputStream
public class ZipOutputStream extends FilterOutputStream (Code)
Reimplementation of java.util.zip.ZipOutputStreamjava.util.zip.ZipOutputStream that does handle the extended functionality of this package, especially internal/external file attributes and extra fields with different layouts for local file data and central directory entries.

This class will try to use java.io.RandomAccessFileRandomAccessFile when you know that the output is going to go to a file.

If RandomAccessFile cannot be used, this implementation will use a Data Descriptor to store size and CRC information for ZipOutputStream.DEFLATED DEFLATED entries, this means, you don't need to calculate them yourself. Unfortunately this is not possible for the ZipOutputStream.STORED STORED method, here setting the CRC and uncompressed size information is required before ZipOutputStream.putNextEntry putNextEntry can be called.


author:
   Stefan Bodewig
author:
   Richard Evans
version:
   $Revision: 1.17.2.3 $


Field Summary
final protected static  ZipLongCFH_SIG
    
final protected static  ZipLongDD_SIG
    
final public static  intDEFLATED
     Compression method for deflated entries.
final protected static  ZipLongEOCD_SIG
    
final protected static  ZipLongLFH_SIG
    
final public static  intSTORED
     Compression method for deflated entries.
protected  byte[]buf
     Deflater buffer

This attribute is only protected to provide a level of API backwards compatibility.

protected  Deflaterdef
     Deflater object for output

This attribute is only protected to provide a level of API backwards compatibility.


Constructor Summary
public  ZipOutputStream(OutputStream out)
     Creates a new ZIP OutputStream filtering the underlying stream.
public  ZipOutputStream(File file)
     Creates a new ZIP OutputStream writing to a File.

Method Summary
public  voidclose()
     Closes this output stream and releases any system resources associated with the stream.
public  voidcloseEntry()
     Writes all necessary data for this entry.
final protected  voiddeflate()
     Writes next block of compressed data to the output stream.
public  voidfinish()
     Finishs writing the contents and closes this as well as the underlying stream.
public  voidflush()
     Flushes this output stream and forces any buffered output bytes to be written out to the stream.
protected  byte[]getBytes(String name)
     Retrieve the bytes for the given String in the encoding set for this Stream.
public  StringgetEncoding()
     The encoding to use for filenames and the file comment.
public  booleanisSeekable()
     Is this archive writing to a seekable stream (i.e.
public  voidputNextEntry(ZipEntry ze)
     Begin writing next entry.
public  voidsetComment(String comment)
     Set the file comment.
public  voidsetEncoding(String encoding)
     The encoding to use for filenames and the file comment.
public  voidsetLevel(int level)
     Sets the compression level for subsequent entries.
public  voidsetMethod(int method)
     Sets the default compression method for subsequent entries.
protected static  ZipLongtoDosTime(Date time)
     Convert a Date object to a DOS date/time field.
public  voidwrite(byte[] b, int offset, int length)
     Writes bytes to ZIP entry.
public  voidwrite(int b)
     Writes a single byte to ZIP entry.
protected  voidwriteCentralDirectoryEnd()
    
protected  voidwriteCentralFileHeader(ZipEntry ze)
    
protected  voidwriteDataDescriptor(ZipEntry ze)
    
protected  voidwriteLocalFileHeader(ZipEntry ze)
    
final protected  voidwriteOut(byte[] data)
    
final protected  voidwriteOut(byte[] data, int offset, int length)
    

Field Detail
CFH_SIG
final protected static ZipLong CFH_SIG(Code)
central file header signature
since:
   1.1



DD_SIG
final protected static ZipLong DD_SIG(Code)
data descriptor signature
since:
   1.1



DEFLATED
final public static int DEFLATED(Code)
Compression method for deflated entries.
since:
   1.1



EOCD_SIG
final protected static ZipLong EOCD_SIG(Code)
end of central dir signature
since:
   1.1



LFH_SIG
final protected static ZipLong LFH_SIG(Code)
local file header signature
since:
   1.1



STORED
final public static int STORED(Code)
Compression method for deflated entries.
since:
   1.1



buf
protected byte[] buf(Code)
Deflater buffer

This attribute is only protected to provide a level of API backwards compatibility. This class used to extend java.util.zip.DeflaterOutputStream DeflaterOutputStream up to Revision 1.13.


since:
   1.14



def
protected Deflater def(Code)
Deflater object for output

This attribute is only protected to provide a level of API backwards compatibility. This class used to extend java.util.zip.DeflaterOutputStream DeflaterOutputStream up to Revision 1.13.


since:
   1.14




Constructor Detail
ZipOutputStream
public ZipOutputStream(OutputStream out)(Code)
Creates a new ZIP OutputStream filtering the underlying stream.
since:
   1.1



ZipOutputStream
public ZipOutputStream(File file) throws IOException(Code)
Creates a new ZIP OutputStream writing to a File. Will use random access if possible.
since:
   1.14




Method Detail
close
public void close() throws IOException(Code)
Closes this output stream and releases any system resources associated with the stream.
exception:
  IOException - if an I/O error occurs.
since:
   1.14



closeEntry
public void closeEntry() throws IOException(Code)
Writes all necessary data for this entry.
since:
   1.1



deflate
final protected void deflate() throws IOException(Code)
Writes next block of compressed data to the output stream.
since:
   1.14



finish
public void finish() throws IOException(Code)
Finishs writing the contents and closes this as well as the underlying stream.
since:
   1.1



flush
public void flush() throws IOException(Code)
Flushes this output stream and forces any buffered output bytes to be written out to the stream.
exception:
  IOException - if an I/O error occurs.
since:
   1.14



getBytes
protected byte[] getBytes(String name) throws ZipException(Code)
Retrieve the bytes for the given String in the encoding set for this Stream.
since:
   1.3



getEncoding
public String getEncoding()(Code)
The encoding to use for filenames and the file comment. null if using the platform's default character encoding.
since:
   1.3



isSeekable
public boolean isSeekable()(Code)
Is this archive writing to a seekable stream (i.e. a random access file)?

For seekable streams, you don't need to calculate the CRC or uncompressed size for ZipOutputStream.STORED STORED entries before invoking ZipOutputStream.putNextEntry putNextEntry .
since:
   1.17




putNextEntry
public void putNextEntry(ZipEntry ze) throws IOException(Code)
Begin writing next entry.
since:
   1.1



setComment
public void setComment(String comment)(Code)
Set the file comment.
since:
   1.1



setEncoding
public void setEncoding(String encoding)(Code)
The encoding to use for filenames and the file comment.

For a list of possible values see http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html. Defaults to the platform's default character encoding.


since:
   1.3



setLevel
public void setLevel(int level)(Code)
Sets the compression level for subsequent entries.

Default is Deflater.DEFAULT_COMPRESSION.


since:
   1.1



setMethod
public void setMethod(int method)(Code)
Sets the default compression method for subsequent entries.

Default is DEFLATED.


since:
   1.1



toDosTime
protected static ZipLong toDosTime(Date time)(Code)
Convert a Date object to a DOS date/time field.

Stolen from InfoZip's fileio.c


since:
   1.1



write
public void write(byte[] b, int offset, int length) throws IOException(Code)
Writes bytes to ZIP entry.



write
public void write(int b) throws IOException(Code)
Writes a single byte to ZIP entry.

Delegates to the three arg method.


since:
   1.14



writeCentralDirectoryEnd
protected void writeCentralDirectoryEnd() throws IOException(Code)
Writes the "End of central dir record"
since:
   1.1



writeCentralFileHeader
protected void writeCentralFileHeader(ZipEntry ze) throws IOException(Code)
Writes the central file header entry
since:
   1.1



writeDataDescriptor
protected void writeDataDescriptor(ZipEntry ze) throws IOException(Code)
Writes the data descriptor entry
since:
   1.1



writeLocalFileHeader
protected void writeLocalFileHeader(ZipEntry ze) throws IOException(Code)
Writes the local file header entry
since:
   1.1



writeOut
final protected void writeOut(byte[] data) throws IOException(Code)
Write bytes to output or random access file
since:
   1.14



writeOut
final protected void writeOut(byte[] data, int offset, int length) throws IOException(Code)
Write bytes to output or random access file
since:
   1.14



Fields inherited from java.io.FilterOutputStream
protected OutputStream out(Code)(Java Doc)

Methods inherited from java.io.FilterOutputStream
public void close() throws IOException(Code)(Java Doc)
public void flush() throws IOException(Code)(Java Doc)
public void write(int b) throws IOException(Code)(Java Doc)
public void write(byte b) throws IOException(Code)(Java Doc)
public void write(byte b, int off, int len) throws IOException(Code)(Java Doc)

Methods inherited from java.io.OutputStream
public void close() throws IOException(Code)(Java Doc)
public void flush() throws IOException(Code)(Java Doc)
abstract public void write(int b) throws IOException(Code)(Java Doc)
public void write(byte b) throws IOException(Code)(Java Doc)
public void write(byte b, int off, int len) throws IOException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.