Java Doc for ZipFile.java in  » 6.0-JDK-Modules » j2me » java » util » 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 » 6.0 JDK Modules » j2me » java.util.zip 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.zip.ZipFile

All known Subclasses:   java.util.jar.JarFile,
ZipFile
public class ZipFile implements ZipConstants(Code)
This class is used to read entries from a zip file.
version:
   1.60, 10/10/06
author:
   David Connelly


Field Summary
final public static  intOPEN_DELETE
     Mode flag to open a zip file and mark it for deletion.
final public static  intOPEN_READ
     Mode flag to open a zip file for reading.

Constructor Summary
public  ZipFile(String name)
     Opens a zip file for reading.
public  ZipFile(File file, int mode)
     Opens a new ZipFile to read from the specified File object in the specified mode.
public  ZipFile(File file)
     Opens a ZIP file for reading given the specified File object.

Method Summary
public  voidclose()
     Closes the ZIP file.
public  Enumerationentries()
     Returns an enumeration of the ZIP file entries.
protected  voidfinalize()
     Ensures that the close method of this ZIP file is called when there are no more references to it.
public  ZipEntrygetEntry(String name)
     Returns the zip file entry for the specified name, or null if not found.
public  InputStreamgetInputStream(ZipEntry entry)
     Returns an input stream for reading the contents of the specified zip file entry.
public  StringgetName()
     Returns the path name of the ZIP file.
public  intsize()
     Returns the number of entries in the ZIP file.

Field Detail
OPEN_DELETE
final public static int OPEN_DELETE(Code)
Mode flag to open a zip file and mark it for deletion. The file will be deleted some time between the moment that it is opened and the moment that it is closed, but its contents will remain accessible via the ZipFile object until either the close method is invoked or the virtual machine exits.



OPEN_READ
final public static int OPEN_READ(Code)
Mode flag to open a zip file for reading.




Constructor Detail
ZipFile
public ZipFile(String name) throws IOException(Code)
Opens a zip file for reading.

First, if there is a security manager, its checkRead method is called with the name argument as its argument to ensure the read is allowed.
Parameters:
  name - the name of the zip file
exception:
  ZipException - if a ZIP format error has occurred
exception:
  IOException - if an I/O error has occurred
exception:
  SecurityException - if a security manager exists and its checkRead method doesn't allow read access to the file.
See Also:   SecurityManager.checkRead(java.lang.String)




ZipFile
public ZipFile(File file, int mode) throws IOException(Code)
Opens a new ZipFile to read from the specified File object in the specified mode. The mode argument must be either OPEN_READ or OPEN_READ | OPEN_DELETE.

First, if there is a security manager, its checkRead method is called with the name argument as its argument to ensure the read is allowed.
Parameters:
  file - the ZIP file to be opened for reading
Parameters:
  mode - the mode in which the file is to be opened
exception:
  ZipException - if a ZIP format error has occurred
exception:
  IOException - if an I/O error has occurred
exception:
  SecurityException - if a security manager exists and its checkRead method doesn't allow read access to the file,or checkDelete method doesn't allow deleting the filewhen OPEN_DELETE flag is set.
exception:
  IllegalArgumentException - If the mode argument is invalid
See Also:   SecurityManager.checkRead(java.lang.String)




ZipFile
public ZipFile(File file) throws ZipException, IOException(Code)
Opens a ZIP file for reading given the specified File object.
Parameters:
  file - the ZIP file to be opened for reading
exception:
  ZipException - if a ZIP error has occurred
exception:
  IOException - if an I/O error has occurred




Method Detail
close
public void close() throws IOException(Code)
Closes the ZIP file.

Closing this ZIP file will close all of the input streams previously returned by invocations of the ZipFile.getInputStreamgetInputStream method.
throws:
  IOException - if an I/O error has occured




entries
public Enumeration entries()(Code)
Returns an enumeration of the ZIP file entries. an enumeration of the ZIP file entries
exception:
  IllegalStateException - if the zip file has been closed



finalize
protected void finalize() throws IOException(Code)
Ensures that the close method of this ZIP file is called when there are no more references to it.

Since the time when GC would invoke this method is undetermined, it is strongly recommanded that applications invoke the close method as soon they have finished accessing this ZipFile. This will prevent holding up system resources for an undetermined length of time.
exception:
  IOException - if an I/O error occurs.
See Also:   java.util.zip.ZipFile.close




getEntry
public ZipEntry getEntry(String name)(Code)
Returns the zip file entry for the specified name, or null if not found.
Parameters:
  name - the name of the entry the zip file entry, or null if not found
exception:
  IllegalStateException - if the zip file has been closed



getInputStream
public InputStream getInputStream(ZipEntry entry) throws IOException(Code)
Returns an input stream for reading the contents of the specified zip file entry. Returns an input stream for reading the contents of the specified zip file entry.

Closing this ZIP file will, in turn, close all input streams that have been returned by invocations of this method.
Parameters:
  entry - the zip file entry the input stream for reading the contents of the specifiedzip file entry.
exception:
  ZipException - if a ZIP format error has occurred
exception:
  IOException - if an I/O error has occurred
exception:
  IllegalStateException - if the zip file has been closed




getName
public String getName()(Code)
Returns the path name of the ZIP file. the path name of the ZIP file



size
public int size()(Code)
Returns the number of entries in the ZIP file. the number of entries in the ZIP file
exception:
  IllegalStateException - if the zip file has been closed



Methods inherited from java.lang.Object
public boolean equals(Object obj)(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.