亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cnzipoutputstream.java

?? Java程序100例
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * @(#)CNZipOutputStream.java	1.27 03/02/07
 *
 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package java.util.zip;

import java.io.OutputStream;
import java.io.IOException;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;

/**
 * This class implements an output stream filter for writing files in the
 * ZIP file format. Includes support for both compressed and uncompressed
 * entries.
 *
 * @author	David Connelly
 * @version	1.27, 02/07/03
 */
public
class CNZipOutputStream extends DeflaterOutputStream implements ZipConstants {
    private ZipEntry entry;
    private Vector entries = new Vector();
    private Hashtable names = new Hashtable();
    private CRC32 crc = new CRC32();
    private long written;
    private long locoff = 0;
    private String comment;
    private int method = DEFLATED;
    private boolean finished;
    private String encoding="UTF-8"; 

    private boolean closed = false;
    
    /**
     * Check to make sure that this stream has not been closed
     */
    private void ensureOpen() throws IOException {
	if (closed) {
	    throw new IOException("Stream closed");
        }
    }
    /**
     * Compression method for uncompressed (STORED) entries.
     */
    public static final int STORED = ZipEntry.STORED;

    /**
     * Compression method for compressed (DEFLATED) entries.
     */
    public static final int DEFLATED = ZipEntry.DEFLATED;

    /**
     * Creates a new ZIP output stream.
     * @param out the actual output stream
     */
    public CNZipOutputStream(OutputStream out) {
	super(out, new Deflater(Deflater.DEFAULT_COMPRESSION, true));
        usesDefaultDeflater = true;
    }
    
   public CNZipOutputStream(OutputStream out,String encoding) { 
     super(out, new Deflater(Deflater.DEFAULT_COMPRESSION, true)); 
     usesDefaultDeflater = true; 
     this.encoding=encoding; 
  } 


    /**
     * Sets the ZIP file comment.
     * @param comment the comment string
     * @exception IllegalArgumentException if the length of the specified
     *		  ZIP file comment is greater than 0xFFFF bytes
     */
    public void setComment(String comment) {
        if (comment != null && comment.length() > 0xffff/3 
                                           && getUTF8Length(comment) > 0xffff) {
	    throw new IllegalArgumentException("ZIP file comment too long.");
	}
	this.comment = comment;
    }

    /**
     * Sets the default compression method for subsequent entries. This
     * default will be used whenever the compression method is not specified
     * for an individual ZIP file entry, and is initially set to DEFLATED.
     * @param method the default compression method
     * @exception IllegalArgumentException if the specified compression method
     *		  is invalid
     */
    public void setMethod(int method) {
	if (method != DEFLATED && method != STORED) {
	    throw new IllegalArgumentException("invalid compression method");
	}
	this.method = method;
    }

    /**
     * Sets the compression level for subsequent entries which are DEFLATED.
     * The default setting is DEFAULT_COMPRESSION.
     * @param level the compression level (0-9)
     * @exception IllegalArgumentException if the compression level is invalid
     */
    public void setLevel(int level) {
	def.setLevel(level);
    }

    /**
     * Begins writing a new ZIP file entry and positions the stream to the
     * start of the entry data. Closes the current entry if still active.
     * The default compression method will be used if no compression method
     * was specified for the entry, and the current time will be used if
     * the entry has no set modification time.
     * @param e the ZIP entry to be written
     * @exception ZipException if a ZIP format error has occurred
     * @exception IOException if an I/O error has occurred
     */
    public void putNextEntry(ZipEntry e) throws IOException {
	ensureOpen();
	if (entry != null) {
	    closeEntry();	// close previous entry
	}
	if (e.time == -1) {
	    e.setTime(System.currentTimeMillis());
	}
	if (e.method == -1) {
	    e.method = method;	// use default method
	}
	switch (e.method) {
	case DEFLATED:
	    if (e.size == -1 || e.csize == -1 || e.crc == -1) {
		// store size, compressed size, and crc-32 in data descriptor
		// immediately following the compressed entry data
		e.flag = 8;
	    } else if (e.size != -1 && e.csize != -1 && e.crc != -1) {
		// store size, compressed size, and crc-32 in LOC header
		e.flag = 0;
	    } else {
		throw new ZipException(
		    "DEFLATED entry missing size, compressed size, or crc-32");
	    }
	    e.version = 20;
	    break;
	case STORED:
	    // compressed size, uncompressed size, and crc-32 must all be
	    // set for entries using STORED compression method
	    if (e.size == -1) {
		e.size = e.csize;
	    } else if (e.csize == -1) {
		e.csize = e.size;
	    } else if (e.size != e.csize) {
		throw new ZipException(
		    "STORED entry where compressed != uncompressed size");
	    }
	    if (e.size == -1 || e.crc == -1) {
		throw new ZipException(
		    "STORED entry missing size, compressed size, or crc-32");
	    }
	    e.version = 10;
	    e.flag = 0;
	    break;
	default:
	    throw new ZipException("unsupported compression method");
	}
	e.offset = written;
	if (names.put(e.name, e) != null) {
	    throw new ZipException("duplicate entry: " + e.name);
	}
        writeLOC(e);
	entries.addElement(e);
	entry = e;
    }

    /**
     * Closes the current ZIP entry and positions the stream for writing
     * the next entry.
     * @exception ZipException if a ZIP format error has occurred
     * @exception IOException if an I/O error has occurred
     */
    public void closeEntry() throws IOException {
	ensureOpen();
	ZipEntry e = entry;
	if (e != null) {
	    switch (e.method) {
	    case DEFLATED:
		def.finish();
		while (!def.finished()) {
		    deflate();
		}
		if ((e.flag & 8) == 0) {
		    // verify size, compressed size, and crc-32 settings
		    if (e.size != def.getTotalIn()) {
			throw new ZipException(
			    "invalid entry size (expected " + e.size +
			    " but got " + def.getTotalIn() + " bytes)");
		    }
		    if (e.csize != def.getTotalOut()) {
			throw new ZipException(
			    "invalid entry compressed size (expected " +
			    e.csize + " but got " + def.getTotalOut() +
			    " bytes)");
		    }
		    if (e.crc != crc.getValue()) {
			throw new ZipException(
			    "invalid entry CRC-32 (expected 0x" +
			    Long.toHexString(e.crc) + " but got 0x" +
			    Long.toHexString(crc.getValue()) + ")");
		    }
		} else {
		    e.size = def.getTotalIn();
		    e.csize = def.getTotalOut();
		    e.crc = crc.getValue();
		    writeEXT(e);
		}
		def.reset();
		written += e.csize;
		break;
	    case STORED:
		// we already know that both e.size and e.csize are the same
		if (e.size != written - locoff) {
		    throw new ZipException(
			"invalid entry size (expected " + e.size +
			" but got " + (written - locoff) + " bytes)");
		}
		if (e.crc != crc.getValue()) {
		    throw new ZipException(
			 "invalid entry crc-32 (expected 0x" +
			 Long.toHexString(e.crc) + " but got 0x" +
			 Long.toHexString(crc.getValue()) + ")");
		}
		break;
	    default:
		throw new InternalError("invalid compression method");
	    }
	    crc.reset();
	    entry = null;
	}
    }

    /**
     * Writes an array of bytes to the current ZIP entry data. This method
     * will block until all the bytes are written.
     * @param b the data to be written
     * @param off the start offset in the data
     * @param len the number of bytes that are written
     * @exception ZipException if a ZIP file error has occurred
     * @exception IOException if an I/O error has occurred
     */
    public synchronized void write(byte[] b, int off, int len)
	throws IOException
    {
	ensureOpen();
        if (off < 0 || len < 0 || off > b.length - len) {
	    throw new IndexOutOfBoundsException();
	} else if (len == 0) {
	    return;
	}

	if (entry == null) {
	    throw new ZipException("no current ZIP entry");
	}
	switch (entry.method) {

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91小宝寻花一区二区三区| 久久久99精品久久| 欧洲一区二区三区在线| 成人精品在线视频观看| 国产sm精品调教视频网站| 国产在线精品一区二区三区不卡| 日韩va亚洲va欧美va久久| 亚洲成人精品在线观看| 亚洲成a人在线观看| 日韩中文字幕不卡| 欧美aa在线视频| 久久99精品国产麻豆婷婷| 久草在线在线精品观看| 国产一区二区三区香蕉| 国产成人av在线影院| 成人h精品动漫一区二区三区| 国产成人av电影| 91丨九色丨蝌蚪富婆spa| 欧美性受xxxx黑人xyx性爽| 欧美少妇xxx| 777xxx欧美| 久久久影视传媒| **性色生活片久久毛片| 一区二区三区久久| 日本一区中文字幕| 国产综合久久久久影院| www.视频一区| 欧美日本一区二区在线观看| 日韩欧美国产综合| 国产偷国产偷精品高清尤物| 亚洲欧美日韩国产成人精品影院| 亚洲国产综合91精品麻豆| 六月丁香婷婷久久| jizz一区二区| 欧美老年两性高潮| 久久亚洲精精品中文字幕早川悠里 | 国产传媒一区在线| 粉嫩欧美一区二区三区高清影视| 91久久精品一区二区三区| 欧美一级日韩一级| 国产欧美一区二区精品忘忧草| 亚洲人成在线播放网站岛国 | av不卡一区二区三区| 欧美色综合天天久久综合精品| 日韩一区二区影院| 国产精品伦理在线| 亚洲国产另类精品专区| 国产精品主播直播| 欧美日韩一区久久| 日本一区二区电影| 日韩av网站在线观看| 成人a免费在线看| 欧美一级黄色大片| 亚洲三级视频在线观看| 久草在线在线精品观看| 91豆麻精品91久久久久久| 欧美精品一区二区三区蜜桃| 亚洲女性喷水在线观看一区| 激情偷乱视频一区二区三区| 色哟哟日韩精品| 久久精品一区二区三区不卡牛牛| 亚洲国产中文字幕在线视频综合| 国产成人亚洲精品青草天美| 欧美日韩国产精选| 亚洲视频一区二区在线观看| 国产一区二区三区免费播放 | 国产精品欧美一区喷水| 日日欢夜夜爽一区| 99r国产精品| 精品福利av导航| 视频一区免费在线观看| 色哟哟一区二区在线观看 | 免费精品视频最新在线| 色狠狠综合天天综合综合| 国产亚洲人成网站| 人人超碰91尤物精品国产| 91久久精品一区二区| 日本一区二区三区dvd视频在线| 麻豆91免费看| 欧美日韩一区视频| 怡红院av一区二区三区| 成人黄色网址在线观看| 久久综合九色综合97婷婷女人| 免费在线视频一区| 欧美日韩一区二区三区高清| 亚洲欧美另类在线| 不卡影院免费观看| 欧美国产激情一区二区三区蜜月| 九九九久久久精品| 欧美一区二区三区播放老司机| 一二三四社区欧美黄| 91天堂素人约啪| 综合欧美亚洲日本| a美女胸又www黄视频久久| 久久精品亚洲精品国产欧美| 久久aⅴ国产欧美74aaa| 日韩一区二区免费在线观看| 天天操天天干天天综合网| 在线免费观看成人短视频| 亚洲美女在线国产| 91视频免费播放| 亚洲色图欧洲色图| 一本大道久久a久久精品综合 | 成人开心网精品视频| 国产日产欧美一区| 成人动漫一区二区| 日韩一区有码在线| 色一区在线观看| 亚洲国产一二三| 正在播放一区二区| 蜜桃视频在线观看一区二区| 精品少妇一区二区三区免费观看 | 日韩一区二区影院| 久久精品国产亚洲高清剧情介绍 | 男人的j进女人的j一区| 日韩精品专区在线影院观看| 久久国产尿小便嘘嘘| 2019国产精品| www.亚洲人| 亚洲精品成人a在线观看| 欧美日韩中文字幕一区| 日本亚洲最大的色成网站www| 日韩亚洲欧美高清| 国产专区综合网| 中文字幕日本不卡| 在线观看成人免费视频| 日韩不卡在线观看日韩不卡视频| 自拍偷拍欧美精品| 一本一道综合狠狠老| 午夜精品一区在线观看| 日韩一级完整毛片| 国产不卡视频在线观看| 亚洲黄色录像片| 欧美mv和日韩mv的网站| kk眼镜猥琐国模调教系列一区二区| 亚洲男人的天堂在线aⅴ视频| 欧美日本国产视频| 国产一区 二区| 一区二区三区中文字幕电影| 日韩欧美一卡二卡| 不卡一区在线观看| 日韩av不卡在线观看| 国产午夜精品理论片a级大结局| 91美女蜜桃在线| 久久91精品国产91久久小草| 亚洲婷婷综合久久一本伊一区| 91精品国产综合久久婷婷香蕉 | 欧美性受xxxx黑人xyx性爽| 久久精品72免费观看| 国产精品国模大尺度视频| 欧美日本乱大交xxxxx| 国产成人一级电影| 亚洲成av人综合在线观看| 国产亚洲短视频| 欧美日韩成人在线一区| 国产成人免费视频| 日韩高清一区在线| 亚洲视频资源在线| 精品国产免费一区二区三区香蕉 | 一区二区三区中文免费| 精品国产乱码久久久久久蜜臀| 91免费观看视频| 黄一区二区三区| 亚洲午夜久久久久久久久电影网| 国产亚洲精品aa| 欧美日韩视频专区在线播放| 粗大黑人巨茎大战欧美成人| 日韩精品一级中文字幕精品视频免费观看 | 国产精品视频一二三区| 欧美福利一区二区| 99国内精品久久| 黄色日韩三级电影| 日韩中文欧美在线| 一区二区三区免费在线观看| 久久久久久久综合狠狠综合| 777xxx欧美| 欧美亚洲国产一卡| av亚洲精华国产精华精华| 蜜桃一区二区三区在线| 亚洲成人精品一区| 一区二区三区在线观看网站| 国产精品萝li| 国产亚洲综合在线| 精品欧美久久久| 91精品国产综合久久精品图片 | 久久精品在线免费观看| 欧美一二三在线| 欧美日韩午夜在线| 在线免费不卡视频| 91蝌蚪porny| 成人a免费在线看| 国产高清不卡一区二区| 精品一区二区三区不卡| 男女激情视频一区| 日韩国产欧美三级| 午夜精品福利久久久| 亚洲激情图片一区| 亚洲日本在线a| 亚洲视频资源在线| 亚洲免费资源在线播放|