Sdílet prostřednictvím


ZipFile Constructors

Definition

Overloads

ZipFile(File)

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

ZipFile(String)

Opens a zip file for reading.

ZipFile(File, Charset)

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

ZipFile(File, Int32)

Opens a new ZipFile to read from the specified File object in the specified mode.

ZipFile(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

ZipFile(String, Charset)

Opens a zip file for reading.

ZipFile(File, Int32, Charset)

Opens a new ZipFile to read from the specified File object in the specified mode.

ZipFile(File)

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

[Android.Runtime.Register(".ctor", "(Ljava/io/File;)V", "")]
public ZipFile (Java.IO.File? file);
[<Android.Runtime.Register(".ctor", "(Ljava/io/File;)V", "")>]
new Java.Util.Zip.ZipFile : Java.IO.File -> Java.Util.Zip.ZipFile

Parameters

file
File

the ZIP file to be opened for reading

Attributes

Exceptions

if a zip error occurs.

if an IOException occurs.

Remarks

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

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

Java documentation for java.util.zip.ZipFile.ZipFile(java.io.File).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ZipFile(String)

Opens a zip file for reading.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")]
public ZipFile (string? name);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")>]
new Java.Util.Zip.ZipFile : string -> Java.Util.Zip.ZipFile

Parameters

name
String

the name of the zip file

Attributes

Exceptions

if an IOException occurs.

Remarks

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 java.nio.charset.Charset charset is used to decode the entry names and comments.

If the app targets Android U or above, zip file entry names containing ".." or starting with "/" passed here will throw a ZipException. For more details, see dalvik.system.ZipPathValidator.

Java documentation for java.util.zip.ZipFile.ZipFile(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ZipFile(File, Charset)

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

[Android.Runtime.Register(".ctor", "(Ljava/io/File;Ljava/nio/charset/Charset;)V", "", ApiSince=24)]
public ZipFile (Java.IO.File? file, Java.Nio.Charset.Charset? charset);
[<Android.Runtime.Register(".ctor", "(Ljava/io/File;Ljava/nio/charset/Charset;)V", "", ApiSince=24)>]
new Java.Util.Zip.ZipFile : Java.IO.File * Java.Nio.Charset.Charset -> Java.Util.Zip.ZipFile

Parameters

file
File

the ZIP file to be opened for reading

charset
Charset

The java.nio.charset.Charset 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).

Attributes

Remarks

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

Added in 1.7.

Java documentation for java.util.zip.ZipFile.ZipFile(java.io.File, java.nio.charset.Charset).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ZipFile(File, Int32)

Opens a new ZipFile to read from the specified File object in the specified mode.

[Android.Runtime.Register(".ctor", "(Ljava/io/File;I)V", "")]
public ZipFile (Java.IO.File? file, int mode);
[<Android.Runtime.Register(".ctor", "(Ljava/io/File;I)V", "")>]
new Java.Util.Zip.ZipFile : Java.IO.File * int -> Java.Util.Zip.ZipFile

Parameters

file
File

the ZIP file to be opened for reading

mode
Int32

the mode in which the file is to be opened

Attributes

Exceptions

if an IOException occurs.

Remarks

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 java.nio.charset.Charset charset is used to decode the entry names and comments

Added in 1.3.

Java documentation for java.util.zip.ZipFile.ZipFile(java.io.File, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ZipFile(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

protected ZipFile (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Java.Util.Zip.ZipFile : nativeint * Android.Runtime.JniHandleOwnership -> Java.Util.Zip.ZipFile

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ZipFile(String, Charset)

Opens a zip file for reading.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/nio/charset/Charset;)V", "", ApiSince=24)]
public ZipFile (string? name, Java.Nio.Charset.Charset? charset);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/nio/charset/Charset;)V", "", ApiSince=24)>]
new Java.Util.Zip.ZipFile : string * Java.Nio.Charset.Charset -> Java.Util.Zip.ZipFile

Parameters

name
String

the name of the zip file

charset
Charset

the java.nio.charset.Charset 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).

Attributes

Remarks

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.

Added in 1.7.

Java documentation for java.util.zip.ZipFile.ZipFile(java.lang.String, java.nio.charset.Charset).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ZipFile(File, Int32, Charset)

Opens a new ZipFile to read from the specified File object in the specified mode.

[Android.Runtime.Register(".ctor", "(Ljava/io/File;ILjava/nio/charset/Charset;)V", "", ApiSince=24)]
public ZipFile (Java.IO.File? file, int mode, Java.Nio.Charset.Charset? charset);
[<Android.Runtime.Register(".ctor", "(Ljava/io/File;ILjava/nio/charset/Charset;)V", "", ApiSince=24)>]
new Java.Util.Zip.ZipFile : Java.IO.File * int * Java.Nio.Charset.Charset -> Java.Util.Zip.ZipFile

Parameters

file
File

the ZIP file to be opened for reading

mode
Int32

the mode in which the file is to be opened

charset
Charset

the java.nio.charset.Charset 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).

Attributes

Remarks

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.

Added in 1.7.

Java documentation for java.util.zip.ZipFile.ZipFile(java.io.File, int, java.nio.charset.Charset).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to