分享
 
 
 

java.util.zip.ZipFile翻译

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

[/url] [url=file:///F:/资料/文字资料/j2sdk-1_4_2-doc/docs/api/overview-summary.html]Overview

Package

Class

Use

Tree

Deprecated

Index

Help

JavaTM 2 Platform

Std. Ed. v1.4.2

PREV CLASS NEXT CLASS

FRAMES NO FRAMES All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

java.util.zip

Class ZipFilejava.lang.Object

java.util.zip.ZipFile

All Implemented Interfaces: java.util.zip.ZipConstants Direct Known Subclasses: JarFile public class ZipFile extends Object implements java.util.zip.ZipConstantsThis class is used to read entries from a zip file. 用于从zip文件中读取项的类。

Field Summary

static int

CENATT

static int

CENATX

static int

CENCOM

static int

CENCRC

static int

CENDSK

static int

CENEXT

static int

CENFLG

static int

CENHDR

static int

CENHOW

static int

CENLEN

static int

CENNAM

static int

CENOFF

static long

CENSIG

static int

CENSIZ

static int

CENTIM

static int

CENVEM

static int

CENVER

static int

ENDCOM

static int

ENDHDR

static int

ENDOFF

static long

ENDSIG

static int

ENDSIZ

static int

ENDSUB

static int

ENDTOT

static int

EXTCRC

static int

EXTHDR

static int

EXTLEN

static long

EXTSIG

static int

EXTSIZ

static int

LOCCRC

static int

LOCEXT

static int

LOCFLG

static int

LOCHDR

static int

LOCHOW

static int

LOCLEN

static int

LOCNAM

static long

LOCSIG

static int

LOCSIZ

static int

LOCTIM

static int

LOCVER

static int

OPEN_DELETE

Mode flag to open a zip file and mark it for deletion. zip文件打开的模式标记,标记为删除。

static int

OPEN_READ

Mode flag to open a zip file for reading. zip文件打开的模式标记,标记为读取。

Constructor Summary

ZipFile(File file)

Opens a ZIP file for reading given the specified File object. 打开一个ZIP文件来读取指定的File对象。

ZipFile(File file, int mode)

Opens a new ZipFile to read from the specified File object in the specified mode. 打开一个ZipFile,按指定的模式读取指定的File对象。

ZipFile(String name)

Opens a zip file for reading. 打开一个要读取的zip文件。

Method Summary

void

close()

Closes the ZIP file. 关闭ZIP文件。

Enumeration

entries()

Returns an enumeration of the ZIP file entries. 返回ZIP文件项的枚举。

protected void

finalize()

Ensures that the close method of this ZIP file is called when there are no more references to it. 确保没有对ZIP文件的引用时,调用close方法。

ZipEntry

getEntry(String name)

Returns the zip file entry for the specified name, or null if not found. 返回给定名称的zip文件项,如果未找到,返回null。

InputStream

getInputStream(ZipEntry entry)

Returns an input stream for reading the contents of the specified zip file entry. 返回读取指定zip文件项内容的输入流。

String

getName()

Returns the path name of the ZIP file. 返回ZIP文件的路径名。

int

size()

Returns the number of entries in the ZIP file. 返回ZIP文件中项的数目。

Methods inherited from class java.lang.Object

clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

OPEN_READpublic static final int OPEN_READ

Mode flag to open a zip file for reading. zip文件打开的模式标记,标记为读取。

See Also: Constant Field ValuesOPEN_DELETEpublic 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. zip文件打开的模式标记,标记为删除。删除文件一般在打开时刻和关闭时刻之间,但其内容仍然 可以通过ZipFile对象进行访问直到调用close方法或者虚拟机退出。

See Also: Constant Field ValuesLOCSIGpublic static final long LOCSIG

See Also: Constant Field ValuesEXTSIGpublic static final long EXTSIG

See Also: Constant Field ValuesCENSIGpublic static final long CENSIG

See Also: Constant Field ValuesENDSIGpublic static final long ENDSIG

See Also: Constant Field ValuesLOCHDRpublic static final int LOCHDR

See Also: Constant Field ValuesEXTHDRpublic static final int EXTHDR

See Also: Constant Field ValuesCENHDRpublic static final int CENHDR

See Also: Constant Field ValuesENDHDRpublic static final int ENDHDR

See Also: Constant Field ValuesLOCVERpublic static final int LOCVER

See Also: Constant Field ValuesLOCFLGpublic static final int LOCFLG

See Also: Constant Field ValuesLOCHOWpublic static final int LOCHOW

See Also: Constant Field ValuesLOCTIMpublic static final int LOCTIM

See Also: Constant Field ValuesLOCCRCpublic static final int LOCCRC

See Also: Constant Field ValuesLOCSIZpublic static final int LOCSIZ

See Also: Constant Field ValuesLOCLENpublic static final int LOCLEN

See Also: Constant Field ValuesLOCNAMpublic static final int LOCNAM

See Also: Constant Field ValuesLOCEXTpublic static final int LOCEXT

See Also: Constant Field ValuesEXTCRCpublic static final int EXTCRC

See Also: Constant Field ValuesEXTSIZpublic static final int EXTSIZ

See Also: Constant Field ValuesEXTLENpublic static final int EXTLEN

See Also: Constant Field ValuesCENVEMpublic static final int CENVEM

See Also: Constant Field ValuesCENVERpublic static final int CENVER

See Also: Constant Field ValuesCENFLGpublic static final int CENFLG

See Also: Constant Field ValuesCENHOWpublic static final int CENHOW

See Also: Constant Field ValuesCENTIMpublic static final int CENTIM

See Also: Constant Field ValuesCENCRCpublic static final int CENCRC

See Also: Constant Field ValuesCENSIZpublic static final int CENSIZ

See Also: Constant Field ValuesCENLENpublic static final int CENLEN

See Also: Constant Field ValuesCENNAMpublic static final int CENNAM

See Also: Constant Field ValuesCENEXTpublic static final int CENEXT

See Also: Constant Field ValuesCENCOMpublic static final int CENCOM

See Also: Constant Field ValuesCENDSKpublic static final int CENDSK

See Also: Constant Field ValuesCENATTpublic static final int CENATT

See Also: Constant Field ValuesCENATXpublic static final int CENATX

See Also: Constant Field ValuesCENOFFpublic static final int CENOFF

See Also: Constant Field ValuesENDSUBpublic static final int ENDSUB

See Also: Constant Field ValuesENDTOTpublic static final int ENDTOT

See Also: Constant Field ValuesENDSIZpublic static final int ENDSIZ

See Also: Constant Field ValuesENDOFFpublic static final int ENDOFF

See Also: Constant Field ValuesENDCOMpublic static final int ENDCOM

See Also: Constant Field ValuesConstructor Detail

ZipFilepublic ZipFile(String name)

throws IOException

Opens a zip file for reading. 打开一个要读取的zip文件。 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. 如果存在安全管理器,首先使用name参数作为它的参数调用checkRead方法,来确认允许读取。

Parameters: name - the name of the zip file zip文件名 Throws: ZipException - if a ZIP format error has occurred 如果发生ZIP格式错误抛出 IOException - if an I/O error has occurred 如果发生I/O错误抛出 SecurityException - if a security manager exists and its checkRead method doesn't allow read access to the file. 如果安全管理器存在,它的checkRead方法不允许读取该文件时抛出。 See Also: SecurityManager.checkRead(java.lang.String)ZipFilepublic 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. 打开一个ZipFile,按指定的模式读取指定的File对象。 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. 如果存在安全管理器,首先使用name参数作为它的参数调用checkRead方法,来确认允许读取。

Parameters: file - the ZIP file to be opened for reading 要打开读取的ZIP文件 mode - the mode in which the file is to be opened 文件要打开的模式 Throws: ZipException - if a ZIP format error has occurred 如果发生ZIP格式错误抛出 IOException - if an I/O error has occurred 如果发生I/O错误抛出 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 file when OPEN_DELETE flag is set. 如果安全管理器存在且设置OPEN_DELETE标记,它的checkRead方法不允许读取该文件,或者checkDelete不允许删除该文件时抛出。 IllegalArgumentException - If the mode argument is invalid 如果mode参数无效抛出 See Also: SecurityManager.checkRead(java.lang.String)ZipFilepublic ZipFile(File file)

throws ZipException,

IOException

Opens a ZIP file for reading given the specified File object. 打开一个ZIP文件来读取指定的File对象。

Parameters: file - the ZIP file to be opened for reading 要打开读取的ZIP文件 Throws: ZipException - if a ZIP error has occurred 如果发生ZIP格式错误抛出 IOException - if an I/O error has occurred 如果发生I/O错误抛出Method Detail

getEntrypublic ZipEntry getEntry(String name)

Returns the zip file entry for the specified name, or null if not found. 返回给定名称的zip文件项,如果未找到,返回null。

Parameters: name - the name of the entry 项的名称 Returns: the zip file entry, or null if not found zip文件项,如果未找到,返回null。 Throws: IllegalStateException - if the zip file has been closed 如果zip文件已被关闭抛出getInputStreampublic InputStream getInputStream(ZipEntry entry)

throws IOException

Returns an input stream for reading the contents of the specified zip file entry. 返回读取指定zip文件项内容的输入流。 Closing this ZIP file will, in turn, close all input streams that have been returned by invocations of this method. 关闭ZIP文件,将同时关闭调用该方法返回的所有输入流。

Parameters: entry - the zip file entry zip文件项 Returns: the input stream for reading the contents of the specified zip file entry. 读取指定zip文件项内容的输入流。 Throws: ZipException - if a ZIP format error has occurred 如果发生ZIP格式错误抛出 IOException - if an I/O error has occurred 如果发生I/O错误抛出 IllegalStateException - if the zip file has been closed 如果zip文件已被关闭抛出getNamepublic String getName()

Returns the path name of the ZIP file. 返回ZIP文件的路径名。

Returns: the path name of the ZIP file ZIP文件的路径名entriespublic Enumeration entries()

Returns an enumeration of the ZIP file entries. 返回ZIP文件项的枚举。

Returns: an enumeration of the ZIP file entries ZIP文件项的枚举。 Throws: IllegalStateException - if the zip file has been closed 如果zip文件已被关闭抛出sizepublic int size()

Returns the number of entries in the ZIP file. 返回ZIP文件中项的数目。

Returns: the number of entries in the ZIP file ZIP文件中项的数目 Throws: IllegalStateException - if the zip file has been closed 如果zip文件已被关闭抛出closepublic void close()

throws IOException

Closes the ZIP file. 关闭ZIP文件。 Closing this ZIP file will close all of the input streams previously returned by invocations of the getInputStream method. 关闭ZIP文件,将同时关闭之前调用getInputStream方法返回的所有输入流。

Throws: IOException - if an I/O error has occured 如果发生I/O错误抛出finalizeprotected void finalize()

throws IOException

Ensures that the close method of this ZIP file is called when there are no more references to it. 确保没有对ZIP文件的引用时,调用close方法。 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. 因为GC调用此方法的时间不能确定,因此强烈建议应用程序一旦完成ZipFile的访问, 立即调用close方法。这将避免长时间的占用系统资源。

Overrides: finalize in class ObjectThrows: IOException - if an I/O error occurs. 如果发生I/O错误抛出。 See Also: close()[/url][url=file:///F:/资料/文字资料/j2sdk-1_4_2-doc/docs/api/overview-summary.html]Overview

Package

Class

Use

Tree

Deprecated

Index

Help

JavaTM 2 Platform

Std. Ed. v1.4.2

PREV CLASS NEXT CLASS

FRAMES NO FRAMES All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature

For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有