Download Java Zip File

  
Download Java Zip File 4,0/5 7605 votes
JavaScript is disabled on your browser.
  • Class

Class ZipFile

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. The java.util.zip.ZipFile class is used to read entries from a zip file. Class declaration. Following is the declaration for java.util.zip.ZipFile class − public class ZipFile extends Object implements Closeable Fields. Download pages for older mac. Following are the fields for java.util.zip.ZipFile class − static int CENATT. Static int CENATX. Static int CENCOM. To allow the Java Runtime Environment to run codes, the Java Development Kit includes debuggers that test and find errors in the written language as well as the Java Compiler to compile the codes. /imessage-for-mac-download.html. The Java Virtual Machine is included in the Java Runtime Environment package because the JRE software uses the JVM to run compiled codes. Java SE Runtime Environment 8 Downloads. Do you want to run Java™ programs, or do you want to develop Java programs? If you want to run Java programs, but not develop them, download the Java Runtime Environment, or JRE™.

    • java.util.zip.ZipFile
  • All Implemented Interfaces:
    Closeable, AutoCloseable
    Direct Known Subclasses:
    JarFile

    This class is used to read entries from a zip file.

    Unless otherwise noted, passing a null argument to a constructor or method in this class will cause a NullPointerException to be thrown.

Java 8 Zip File Download

    • Field Summary

      Fields
      Modifier and TypeField and Description
      static intCENATT
      static intCENATX
      static intCENCOM
      static intCENCRC
      static intCENDSK
      static intCENEXT
      static intCENFLG
      static intCENHDR
      static intCENHOW
      static intCENLEN
      static intCENNAM
      static intCENOFF
      static longCENSIG
      static intCENSIZ
      static intCENTIM
      static intCENVEM
      static intCENVER
      static intENDCOM
      static intENDHDR
      static intENDOFF
      static longENDSIG
      static intENDSIZ
      static intENDSUB
      static intENDTOT
      static intEXTCRC
      static intEXTHDR
      static intEXTLEN
      static longEXTSIG
      static intEXTSIZ
      static intLOCCRC
      static intLOCEXT
      static intLOCFLG
      static intLOCHDR
      static intLOCHOW
      static intLOCLEN
      static intLOCNAM
      static longLOCSIG
      static intLOCSIZ
      static intLOCTIM
      static intLOCVER
      static intOPEN_DELETE
      Mode flag to open a zip file and mark it for deletion.
      static intOPEN_READ
    • Constructor Summary

      Constructors
      Constructor and Description
      ZipFile(File file)
      Opens a ZIP file for reading given the specified File object.
      ZipFile(File file, Charset charset)
      Opens a ZIP file for reading given the specified File object.
      ZipFile(File file, int mode)
      Opens a new ZipFile to read from the specified File object in the specified mode.
      ZipFile(File file, int mode, Charset charset)
      Opens a new ZipFile to read from the specified File object in the specified mode.
      ZipFile(String name)
      ZipFile(String name, Charset charset)
      Opens a zip file for reading.
    • Method Summary

      Methods
      Modifier and TypeMethod and Description
      voidclose()
      Enumeration<? extends ZipEntry>entries()
      Returns an enumeration of the ZIP file entries.
      protected voidfinalize()
      Ensures that the system resources held by this ZipFile object are released when there are no more references to it.
      StringgetComment()
      ZipEntrygetEntry(String name)
      Returns the zip file entry for the specified name, or null if not found.
      InputStreamgetInputStream(ZipEntry entry)
      Returns an input stream for reading the contents of the specified zip file entry.
      StringgetName()
      intsize()
      Returns the number of entries in the ZIP file.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • OPEN_READ

        See Also:
        Constant Field Values
      • OPEN_DELETE

        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.
        See Also:
        Constant Field Values
      • LOCSIG

        See Also:
        Constant Field Values
      • EXTSIG

        See Also:
        Constant Field Values
      • CENSIG

        See Also:
        Constant Field Values
      • ENDSIG

        See Also:
        Constant Field Values
      • LOCHDR

        See Also:
        Constant Field Values
      • EXTHDR

        See Also:
        Constant Field Values
      • CENHDR

        See Also:
        Constant Field Values
      • ENDHDR

        See Also:
        Constant Field Values
      • LOCVER

        See Also:
        Constant Field Values
      • LOCFLG

        See Also:
        Constant Field Values
      • LOCHOW

        See Also:
        Constant Field Values
      • LOCTIM

        See Also:
        Constant Field Values
      • LOCCRC

        See Also:
        Constant Field Values
      • LOCSIZ

        See Also:
        Constant Field Values
      • LOCLEN

        See Also:
        Constant Field Values
      • LOCNAM

        See Also:
        Constant Field Values
      • LOCEXT

        See Also:
        Constant Field Values
      • EXTCRC

        See Also:
        Constant Field Values
      • EXTSIZ

        See Also:
        Constant Field Values
      • EXTLEN

        See Also:
        Constant Field Values
      • CENVEM

        See Also:
        Constant Field Values
      • CENVER

        See Also:
        Constant Field Values
      • CENFLG

        See Also:
        Constant Field Values
      • CENHOW

        See Also:
        Constant Field Values
      • CENTIM

        See Also:
        Constant Field Values
      • CENCRC

        See Also:
        Constant Field Values
      • CENSIZ

        See Also:
        Constant Field Values
      • CENLEN

        See Also:
        Constant Field Values
      • CENNAM

        See Also:
        Constant Field Values
      • CENEXT

        See Also:
        Constant Field Values
      • CENCOM

        See Also:
        Constant Field Values
      • CENDSK

        See Also:
        Constant Field Values
      • CENATT

        See Also:
        Constant Field Values
      • CENATX

        See Also:
        Constant Field Values
      • CENOFF

        See Also:
        Constant Field Values
      • ENDSUB

        See Also:
        Constant Field Values
      • ENDTOT

        See Also:
        Constant Field Values
      • ENDSIZ

        See Also:
        Constant Field Values
      • ENDOFF

        See Also:
        Constant Field Values
      • ENDCOM

        See Also:
        Constant Field Values
    • Constructor Detail

      • ZipFile

        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.

        The UTF-8 charset is used to decode the entry names and comments.

        Parameters:
        name - the name of the zip file
        Throws:
        ZipException - if a ZIP format error has occurred
        IOException - if an I/O error has occurred
        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

        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.

        The UTF-8 charset is used to decode the entry names and comments

        Parameters:
        file - the ZIP file to be opened for reading
        mode - the mode in which the file is to be opened
        Throws:
        ZipException - if a ZIP format error has occurred
        IOException - if an I/O error has occurred
        SecurityException - if a security manager exists and its checkRead method doesn't allow read access to the file, or its checkDelete method doesn't allow deleting the file when the OPEN_DELETE flag is set.
        IllegalArgumentException - if the mode argument is invalid
        Since:
        1.3
        See Also:
        SecurityManager.checkRead(java.lang.String)
      • ZipFile

        Opens a ZIP file for reading given the specified File object.

        The UTF-8 charset is used to decode the entry names and comments.

        Parameters:
        file - the ZIP file to be opened for reading
        Throws:
        ZipException - if a ZIP format error has occurred
        IOException - if an I/O error has occurred
      • ZipFile

        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
        mode - the mode in which the file is to be opened
        charset - the charset to be used to decode the ZIP entry name and comment that are not encoded by using UTF-8 encoding (indicated by entry's general purpose flag).
        Throws:
        ZipException - if a ZIP format error has occurred
        IOException - if an I/O error has occurred
        SecurityException - if a security manager exists and its checkRead method doesn't allow read access to the file,or its checkDelete method doesn't allow deleting the file when the OPEN_DELETE flag is set
        IllegalArgumentException - if the mode argument is invalid
        Since:
        1.7
        See Also:
        SecurityManager.checkRead(java.lang.String)
      • ZipFile

        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
        charset - the charset to be used to decode the ZIP entry name and comment that are not encoded by using UTF-8 encoding (indicated by entry's general purpose flag).
        Throws:
        ZipException - if a ZIP format error has occurred
        IOException - if an I/O error has occurred
        SecurityException - if a security manager exists and its checkRead method doesn't allow read access to the file
        Since:
        1.7
        See Also:
        SecurityManager.checkRead(java.lang.String)
      • ZipFile

        Opens a ZIP file for reading given the specified File object.
        Parameters:
        file - the ZIP file to be opened for reading
        charset - The charset to be used to decode the ZIP entry name and comment (ignored if the language encoding bit of the ZIP entry's general purpose bit flag is set).
        Throws:
        ZipException - if a ZIP format error has occurred
        IOException - if an I/O error has occurred
        Since:
        1.7
    • Method Detail

      • getComment

        Returns:
        the comment string for the zip file, or null if none
        Throws:
        IllegalStateException - if the zip file has been closed Since 1.7
      • getEntry

        Returns the zip file entry for the specified name, or null if not found.
        Parameters:
        name - the name of the entry
        Returns:
        the zip file entry, or null if not found
        Throws:
        IllegalStateException - if the zip file has been closed
      • getInputStream

        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
        Returns:
        the input stream for reading the contents of the specified zip file entry.
        Throws:
        ZipException - if a ZIP format error has occurred
        IOException - if an I/O error has occurred
        IllegalStateException - if the zip file has been closed
      • getName

        Returns:
        the path name of the ZIP file
      • entries

        Returns an enumeration of the ZIP file entries.
        Returns:
        an enumeration of the ZIP file entries
        Throws:
        IllegalStateException - if the zip file has been closed
      • size

        Returns:
        the number of entries in the ZIP file
        Throws:
        IllegalStateException - if the zip file has been closed
      • close

        Closes the ZIP file.

        Closing this ZIP file will close all of the input streams previously returned by invocations of the getInputStreamIncredimail 2.5 crack. method.

        Specified by:
        close in interface Closeable
        Specified by:
        close in interface AutoCloseable
        Throws:
        IOException - if an I/O error has occurred
      • finalize

        Ensures that the system resources held by this ZipFile object are released when there are no more references to it.

        Since the time when GC would invoke this method is undetermined, it is strongly recommended 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.

        Overrides:
        finalize in class Object
        Throws:
        IOException - if an I/O error has occurred
        See Also:
        close()
  • Class

Download Java Zip File Viewer

  • Summary:
  • Nested
  • Field
  • Constr
  • Detail:
  • Field
  • Constr

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.

Java Zip File Example

Scripting on this page tracks web page traffic, but does not change the content in any way.