java.util.zip - ZipOutputStream 類



簡介

java.util.zip.ZipOutputStream 類實現了一個輸出流過濾器,用於以 ZIP 檔案格式寫入檔案。包括對壓縮和未壓縮條目的支援。

類宣告

以下是 java.util.zip.ZipOutputStream 類的宣告:

public class ZipOutputStream
   extends DeflaterOutputStream

欄位

以下是 java.util.zip.ZipOutputStream 類的欄位:

  • 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 DEFLATED - 壓縮(DEFLATED)條目的壓縮方法。

  • 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 STORED - 未壓縮(STORED)條目的壓縮方法。

建構函式

序號 建構函式 & 描述
1

ZipOutputStream(OutputStream out)

建立一個新的 ZIP 輸出流。

2

ZipOutputStream(OutputStream out, Charset charset)

建立一個新的 ZIP 輸出流。

類方法

序號 方法 & 描述
1 void close()

關閉 ZIP 輸出流以及正在過濾的流。

2

void closeEntry()

關閉當前 ZIP 條目並將流定位到下一個條目的開頭。

3 void finish()

完成寫入 ZIP 輸出流的內容,而不關閉底層流。

4 void putNextEntry(ZipEntry e)

開始寫入新的 ZIP 檔案條目並將流定位到條目資料的開頭。

5 void setComment(String comment)

設定 ZIP 檔案註釋。

6 void setLevel(int level)

設定後續 DEFLATED 條目的壓縮級別。

7 void setMethod(int method)

設定後續條目的預設壓縮方法。

8 void write(byte[] b, int off, int len)

將位元組陣列寫入當前 ZIP 條目資料。

繼承的方法

此類繼承自以下類的方法:

  • java.util.zip.DeflaterOutputStream
  • java.io.FilterOutputStream
  • java.lang.Object
廣告

© . All rights reserved.