Java jdk zip file

Package java.util.zip

Provides classes for reading and writing the standard ZIP and GZIP file formats. Also includes classes for compressing and decompressing data using the DEFLATE compression algorithm, which is used by the ZIP and GZIP file formats. Additionally, there are utility classes for computing the CRC-32, CRC-32C and Adler-32 checksums of arbitrary input streams.

Package Specification

  • Info-ZIP Application Note 970311 — a detailed description of the Info-ZIP format upon which the java.util.zip classes are based.
  • An implementation may optionally support the ZIP64(tm) format extensions defined by thePKWARE ZIP File Format Specification. The ZIP64(tm) format extensions are used to overcome the size limitations of the original ZIP format.
  • APPENDIX D ofPKWARE ZIP File Format Specification — Language Encoding Flag to encode ZIP entry filename and comment fields using UTF-8.
  • ZLIB Compressed Data Format Specification version 3.3(pdf) (RFC 1950)
  • DEFLATE Compressed Data Format Specification version 1.3(pdf) (RFC 1951)
  • GZIP file format specification version 4.3(pdf) (RFC 1952)
  • CRC-32 checksum is described in RFC 1952 (above)
  • CRC-32C checksum is described in Internet Small Computer Systems Interface (iSCSI)(pdf) (RFC 3720)
  • Adler-32 checksum is described in RFC 1950 (above)
Читайте также:  Синтаксис python ввод вывод

Contains the collections framework, some internationalization support classes, a service loader, properties, random number generation, string parsing and scanning classes, base64 encoding and decoding, a bit array, and several miscellaneous utility classes.

Источник

Java jdk zip file

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.

Field Summary

Constructor Summary

Method Summary

Methods declared in class java.lang.Object

Field Detail

OPEN_READ

public static final int OPEN_READ

OPEN_DELETE

public static final int 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.

LOCSIG

public static final long LOCSIG

EXTSIG

public static final long EXTSIG

CENSIG

public static final long CENSIG

ENDSIG

public static final long ENDSIG

LOCHDR

public static final int LOCHDR

EXTHDR

public static final int EXTHDR

CENHDR

public static final int CENHDR

ENDHDR

public static final int ENDHDR

LOCVER

public static final int LOCVER

LOCFLG

public static final int LOCFLG

LOCHOW

public static final int LOCHOW

LOCTIM

public static final int LOCTIM

LOCCRC

public static final int LOCCRC

LOCSIZ

public static final int LOCSIZ

LOCLEN

public static final int LOCLEN

LOCNAM

public static final int LOCNAM

LOCEXT

public static final int LOCEXT

EXTCRC

public static final int EXTCRC

EXTSIZ

public static final int EXTSIZ

EXTLEN

public static final int EXTLEN

CENVEM

public static final int CENVEM

CENVER

public static final int CENVER

CENFLG

public static final int CENFLG

CENHOW

public static final int CENHOW

CENTIM

public static final int CENTIM

CENCRC

public static final int CENCRC

CENSIZ

public static final int CENSIZ

CENLEN

public static final int CENLEN

CENNAM

public static final int CENNAM

CENEXT

public static final int CENEXT

CENCOM

public static final int CENCOM

CENDSK

public static final int CENDSK

CENATT

public static final int CENATT

CENATX

public static final int CENATX

CENOFF

public static final int CENOFF

ENDSUB

public static final int ENDSUB

ENDTOT

public static final int ENDTOT

ENDSIZ

public static final int ENDSIZ

ENDOFF

public static final int ENDOFF

ENDCOM

public static final int ENDCOM

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.

Читайте также:  Python console pip install

ZipFile

public ZipFile​(File file, int mode) throws IOException

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

ZipFile

public ZipFile​(File file) throws ZipException, IOException

Opens a ZIP file for reading given the specified File object. The UTF-8 charset is used to decode the entry names and comments.

ZipFile

public ZipFile​(File file, int mode, Charset charset) throws IOException

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.

ZipFile

public ZipFile​(String name, Charset charset) throws IOException

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.

ZipFile

public ZipFile​(File file, Charset charset) throws IOException

Method Detail

getComment

getEntry

getInputStream

public InputStream getInputStream​(ZipEntry entry) throws IOException

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.

getName

entries

stream

Returns an ordered Stream over the ZIP file entries. Entries appear in the Stream in the order they appear in the central directory of the ZIP file.

size

close

Closes the ZIP file. Closing this ZIP file will close all of the input streams previously returned by invocations of the getInputStream method.

finalize

@Deprecated(since="9", forRemoval=true) protected void finalize() throws IOException

The finalize method has been deprecated and will be removed. It is implemented as a no-op. Subclasses that override finalize in order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overriding finalize method. The recommended cleanup for ZipFile object is to explicitly invoke close method when it is no longer in use, or use try-with-resources. If the close is not invoked explicitly the resources held by this object will be released when the instance becomes unreachable.

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

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

Источник

Class ZipFile

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

Field Summary

Constructor Summary

Method Summary

Methods declared in class java.lang.Object

Field Details

OPEN_READ

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.

LOCSIG

EXTSIG

CENSIG

ENDSIG

LOCHDR

EXTHDR

CENHDR

ENDHDR

LOCVER

LOCFLG

LOCHOW

LOCTIM

LOCCRC

LOCSIZ

LOCLEN

LOCNAM

LOCEXT

EXTCRC

EXTSIZ

EXTLEN

CENVEM

CENVER

CENFLG

CENHOW

CENTIM

CENCRC

CENSIZ

CENLEN

CENNAM

CENEXT

CENCOM

CENDSK

CENATT

CENATX

CENOFF

ENDSUB

ENDTOT

ENDSIZ

ENDOFF

ENDCOM

Constructor Details

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.

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

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.

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.

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.

ZipFile

Method Details

getComment

getEntry

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.

getName

entries

stream

Returns an ordered Stream over the ZIP file entries. Entries appear in the Stream in the order they appear in the central directory of the ZIP file.

size

close

Closes the ZIP file. Closing this ZIP file will close all of the input streams previously returned by invocations of the getInputStream method.

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

Источник

Package java.util.zip

Provides classes for reading and writing the standard ZIP and GZIP file formats. Also includes classes for compressing and decompressing data using the DEFLATE compression algorithm, which is used by the ZIP and GZIP file formats. Additionally, there are utility classes for computing the CRC-32, CRC-32C and Adler-32 checksums of arbitrary input streams.

Package Specification

  • Info-ZIP Application Note 970311 — a detailed description of the Info-ZIP format upon which the java.util.zip classes are based.
  • An implementation may optionally support the ZIP64(tm) format extensions defined by thePKWARE ZIP File Format Specification. The ZIP64(tm) format extensions are used to overcome the size limitations of the original ZIP format.
  • APPENDIX D ofPKWARE ZIP File Format Specification — Language Encoding Flag to encode ZIP entry filename and comment fields using UTF-8.
  • ZLIB Compressed Data Format Specification version 3.3(pdf) (RFC 1950)
  • DEFLATE Compressed Data Format Specification version 1.3(pdf) (RFC 1951)
  • GZIP file format specification version 4.3(pdf) (RFC 1952)
  • CRC-32 checksum is described in RFC 1952 (above)
  • CRC-32C checksum is described in Internet Small Computer Systems Interface (iSCSI)(pdf) (RFC 3720)
  • Adler-32 checksum is described in RFC 1950 (above)

This class provides support for general purpose compression using the popular ZLIB compression library.

This class implements an output stream filter for compressing data in the «deflate» compression format.

This class provides support for general purpose decompression using the popular ZLIB compression library.

Implements an output stream filter for uncompressing data stored in the «deflate» compression format.

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

Источник

Оцените статью