Java Doc for ZipOutputStream.java in  » Build » ANT » 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 » Build » ANT » 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.



Field Summary
final protected static  byte[]CFH_SIG
    
final protected static  byte[]DD_SIG
    
final public static  intDEFAULT_COMPRESSION
     Default compression level for deflated entries.
final public static  intDEFLATED
     Compression method for deflated entries.
final protected static  byte[]EOCD_SIG
    
final protected static  byte[]LFH_SIG
    
final public static  intSTORED
     Compression method for stored entries.
protected  byte[]buf
     This buffer servers as a Deflater.

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

protected  Deflaterdef
     This Deflater object is used 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
protected static  longadjustToLong(int i)
     Assumes a negative integer really is a positive integer that has wrapped around and re-creates the original value.
Parameters:
  i - the value to treat as unsigned int.
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()
     This method indicates whether this archive is writing to a seekable stream (i.e., to a random access file).
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.
protected static  byte[]toDosTime(long t)
     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()
     Writes the "End of central dir record".
protected  voidwriteCentralFileHeader(ZipEntry ze)
     Writes the central file header entry.
protected  voidwriteDataDescriptor(ZipEntry ze)
     Writes the data descriptor entry.
protected  voidwriteLocalFileHeader(ZipEntry ze)
    
final protected  voidwriteOut(byte[] data)
     Write bytes to output or random access file.
final protected  voidwriteOut(byte[] data, int offset, int length)
     Write bytes to output or random access file.

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



DD_SIG
final protected static byte[] DD_SIG(Code)
data descriptor signature
since:
   1.1



DEFAULT_COMPRESSION
final public static int DEFAULT_COMPRESSION(Code)
Default compression level for deflated entries.
since:
   Ant 1.7



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



EOCD_SIG
final protected static byte[] EOCD_SIG(Code)
end of central dir signature
since:
   1.1



LFH_SIG
final protected static byte[] LFH_SIG(Code)
local file header signature
since:
   1.1



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



buf
protected byte[] buf(Code)
This buffer servers as a Deflater.

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)
This Deflater object is used 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.
Parameters:
  out - the outputstream to zip
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.
Parameters:
  file - the file to zip to
since:
   1.14
throws:
  IOException - on error




Method Detail
adjustToLong
protected static long adjustToLong(int i)(Code)
Assumes a negative integer really is a positive integer that has wrapped around and re-creates the original value.
Parameters:
  i - the value to treat as unsigned int. the unsigned int as a long.
since:
   1.34



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
throws:
  IOException - on error



deflate
final protected void deflate() throws IOException(Code)
Writes next block of compressed data to the output stream.
throws:
  IOException - on error
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
throws:
  IOException - on error



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.
Parameters:
  name - the string to get bytes from the bytes as a byte array
throws:
  ZipException - on error
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)
This method indicates whether this archive is writing to a seekable stream (i.e., to a random access file).

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




putNextEntry
public void putNextEntry(ZipEntry ze) throws IOException(Code)
Begin writing next entry.
Parameters:
  ze - the entry to write
since:
   1.1
throws:
  IOException - on error



setComment
public void setComment(String comment)(Code)
Set the file comment.
Parameters:
  comment - the 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/j2se/1.5.0/docs/guide/intl/encoding.doc.html. Defaults to the platform's default character encoding.


Parameters:
  encoding - the encoding value
since:
   1.3



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

Default is Deflater.DEFAULT_COMPRESSION.


Parameters:
  level - the compression level.
throws:
  IllegalArgumentException - if an invalid compression level is specified.
since:
   1.1



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

Default is DEFLATED.


Parameters:
  method - an int from java.util.zip.ZipEntry
since:
   1.1



toDosTime
protected static ZipLong toDosTime(Date time)(Code)
Convert a Date object to a DOS date/time field.
Parameters:
  time - the Date to convert the date as a ZipLong
since:
   1.1



toDosTime
protected static byte[] toDosTime(long t)(Code)
Convert a Date object to a DOS date/time field.

Stolen from InfoZip's fileio.c


Parameters:
  t - number of milliseconds since the epoch the date as a byte array
since:
   1.26



write
public void write(byte[] b, int offset, int length) throws IOException(Code)
Writes bytes to ZIP entry.
Parameters:
  b - the byte array to write
Parameters:
  offset - the start position to write from
Parameters:
  length - the number of bytes to write
throws:
  IOException - on error



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

Delegates to the three arg method.


Parameters:
  b - the byte to write
since:
   1.14
throws:
  IOException - on error



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



writeCentralFileHeader
protected void writeCentralFileHeader(ZipEntry ze) throws IOException(Code)
Writes the central file header entry.
Parameters:
  ze - the entry to write
throws:
  IOException - on error
since:
   1.1



writeDataDescriptor
protected void writeDataDescriptor(ZipEntry ze) throws IOException(Code)
Writes the data descriptor entry.
Parameters:
  ze - the entry to write
throws:
  IOException - on error
since:
   1.1



writeLocalFileHeader
protected void writeLocalFileHeader(ZipEntry ze) throws IOException(Code)
Writes the local file header entry
Parameters:
  ze - the entry to write
throws:
  IOException - on error
since:
   1.1



writeOut
final protected void writeOut(byte[] data) throws IOException(Code)
Write bytes to output or random access file.
Parameters:
  data - the byte array to write
throws:
  IOException - on error
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.
Parameters:
  data - the byte array to write
Parameters:
  offset - the start position to write from
Parameters:
  length - the number of bytes to write
throws:
  IOException - on error
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.