jp.hishidama.zip
クラス ZipFile

java.lang.Object
  上位を拡張 jp.hishidama.zip.ZipFile
すべての実装されたインタフェース:
Closeable

public class ZipFile
extends Object
implements Closeable

Zipファイルを読み込むクラス.

Info-ZIPのzipcloakとApache AntのZipFileを参考に作ったクラスです。

導入されたバージョン:
2007.12.21
バージョン:
2009.12.20
作成者:
ひしだま

コンストラクタの概要
ZipFile(File f)
          コンストラクター.
ZipFile(File f, String encoding)
          コンストラクター.
ZipFile(String name)
          コンストラクター.
ZipFile(String name, String encoding)
          コンストラクター.
 
メソッドの概要
 void close()
          zipファイルクローズ.
 Enumeration<? extends ZipEntry> entries()
          エントリー列挙.
 String getEncoding()
          エンコーディング取得.
 Enumeration<ZipEntry> getEntries()
          エントリー列挙.
 Iterator<ZipEntry> getEntriesIterator()
          エントリー一覧取得.
 ZipEntry getEntry(String name)
          エントリー取得.
 InputStream getInputStream(ZipEntry ze)
          入力ストリーム取得.
 boolean isCheckCrc()
          CRCチェック有無取得.
 void setCheckCrc(boolean b)
          CRCチェック有無設定.
 void setEncoding(String encoding)
          推奨されていません。 ZipFileでは当メソッドは無効です
 void setPassword(byte[] password)
          パスワード設定.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

ZipFile

public ZipFile(File f)
        throws IOException
コンストラクター.

パラメータ:
f - zipファイル名
例外:
IOException

ZipFile

public ZipFile(File f,
               String encoding)
        throws IOException
コンストラクター.

パラメータ:
f - zipファイル名
encoding - エンコーディング
例外:
IOException

ZipFile

public ZipFile(String name)
        throws IOException
コンストラクター.

パラメータ:
name - zipファイル名
例外:
IOException

ZipFile

public ZipFile(String name,
               String encoding)
        throws IOException
コンストラクター.

パラメータ:
name - zipファイル名
encoding - エンコーディング
例外:
IOException
メソッドの詳細

setEncoding

@Deprecated
public void setEncoding(String encoding)
推奨されていません。 ZipFileでは当メソッドは無効です

エンコーディング設定.

パラメータ:
encoding - エンコーディング

setPassword

public void setPassword(byte[] password)
パスワード設定.

パラメータ:
password - パスワード

setCheckCrc

public void setCheckCrc(boolean b)
CRCチェック有無設定.

データのCRCチェックを行うかどうかを設定します。
CRCチェックを行う場合、getInputStream(ZipEntry) で取得したInputStreamのread()において、CRC不一致の場合にZipCrcExceptionが発生します。

パラメータ:
b - true:CRCチェックを行う
導入されたバージョン:
2008.12.21

isCheckCrc

public boolean isCheckCrc()
CRCチェック有無取得.

戻り値:
true:CRCチェックを行う
導入されたバージョン:
2008.12.21
関連項目:
setCheckCrc(boolean)

close

public void close()
           throws IOException
zipファイルクローズ.

定義:
インタフェース Closeable 内の close
例外:
IOException

entries

public Enumeration<? extends ZipEntry> entries()
エントリー列挙.

当メソッドはjava.util.zip.ZipFile との互換性の為に用意されたものです。

戻り値:
エントリーの列挙
関連項目:
getEntriesIterator()

getEntries

public Enumeration<ZipEntry> getEntries()
エントリー列挙.

当メソッドはorg.apache.tools.zip.ZipFileとの互換性の為に用意されたものです。

戻り値:
エントリーの列挙
関連項目:
getEntriesIterator()

getEntriesIterator

public Iterator<ZipEntry> getEntriesIterator()
エントリー一覧取得.

戻り値:
ZipEntryのイテレーター

getEntry

public ZipEntry getEntry(String name)
エントリー取得.

パラメータ:
name - エントリー名
戻り値:
ZipEntry(存在しない場合、null)

getInputStream

public InputStream getInputStream(ZipEntry ze)
                           throws IOException,
                                  ZipException
入力ストリーム取得.

パラメータ:
ze - エントリー
戻り値:
入力ストリーム
例外:
IOException
ZipException
ZipPasswordException
関連項目:
setCheckCrc(boolean)

getEncoding

public String getEncoding()
エンコーディング取得.

戻り値:
エンコーディング