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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 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) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一本大道综合伊人精品热热 | 亚洲女爱视频在线| 欧美国产97人人爽人人喊| 国产精品 日产精品 欧美精品| 日韩欧美一级二级三级| 久久国产福利国产秒拍| 久久色在线视频| 成人午夜碰碰视频| 亚洲欧美欧美一区二区三区| 99久久婷婷国产综合精品电影| 亚洲美女视频在线观看| 欧美日本不卡视频| 国模一区二区三区白浆| 国产精品白丝在线| 在线观看一区二区视频| 蜜桃精品视频在线观看| 久久久欧美精品sm网站| 色悠久久久久综合欧美99| 日韩av一级电影| 久久精品视频在线看| 在线一区二区三区四区五区| 免费看欧美女人艹b| 亚洲六月丁香色婷婷综合久久 | 国产精品亚洲成人| 国产精品免费久久| 欧美人狂配大交3d怪物一区| 国产老肥熟一区二区三区| 亚洲精品一二三四区| 精品精品欲导航| 欧美精品乱码久久久久久按摩| 久久99久久精品欧美| 国产精品第一页第二页第三页| 欧美亚洲动漫精品| 国产成人av一区二区三区在线 | 精品国产露脸精彩对白| 97se亚洲国产综合自在线不卡| 视频一区免费在线观看| 国产欧美一区在线| 欧美精品aⅴ在线视频| 成人aa视频在线观看| 免费不卡在线观看| 成人av在线电影| 日韩欧美久久一区| 日本午夜精品一区二区三区电影| 国产日产欧美精品一区二区三区| 欧美日韩日本视频| 成人午夜视频在线| 久久电影国产免费久久电影| 亚洲三级视频在线观看| 久久先锋影音av鲁色资源| 欧美亚洲动漫精品| 99久久99久久久精品齐齐| 美女视频一区在线观看| 午夜精品一区二区三区免费视频| 国产精品福利一区二区三区| 精品国产制服丝袜高跟| 欧美视频一区二区三区在线观看| 国产成人午夜99999| 另类成人小视频在线| 亚洲一区二区三区美女| 亚洲欧洲精品天堂一级| 7777精品伊人久久久大香线蕉的 | 中文字幕亚洲区| 亚洲色图一区二区三区| 色噜噜狠狠成人中文综合| ...av二区三区久久精品| 成人激情动漫在线观看| 日本中文字幕一区二区视频| 欧美韩国日本综合| 国产精品乱码一区二三区小蝌蚪| 欧美一级二级在线观看| 欧美狂野另类xxxxoooo| 国产情人综合久久777777| 欧美精品久久久久久久多人混战 | 欧美va亚洲va香蕉在线| 欧美日韩小视频| 欧美日韩国产免费| 欧美精品乱码久久久久久| 欧美日韩精品一区二区天天拍小说| 99re在线精品| 欧美亚洲国产一区二区三区va| 91在线国产福利| 欧美中文字幕亚洲一区二区va在线| 色综合久久久久综合99| 在线亚洲免费视频| 欧美日韩成人激情| 日韩女优视频免费观看| 精品蜜桃在线看| 国产视频一区在线播放| 亚洲欧美一区二区在线观看| 综合久久综合久久| 亚洲成人福利片| 人人超碰91尤物精品国产| 久久99精品一区二区三区| 国产精华液一区二区三区| 成人av午夜电影| 日本高清无吗v一区| 777久久久精品| 欧美zozozo| 亚洲视频免费观看| 亚洲成年人网站在线观看| 琪琪一区二区三区| 国产成人av电影在线观看| av毛片久久久久**hd| 91福利区一区二区三区| 538prom精品视频线放| 国产日韩综合av| 亚洲一区国产视频| 极品少妇一区二区三区精品视频| 国产麻豆成人传媒免费观看| 91在线码无精品| 日韩免费观看高清完整版在线观看| 国产视频一区二区在线观看| 亚洲一区二区偷拍精品| 国产精品一级片在线观看| 91视频观看视频| 日韩一区二区在线看片| 一区在线播放视频| 美女精品自拍一二三四| 一本久久精品一区二区| 日韩精品专区在线影院重磅| 最新日韩在线视频| 毛片基地黄久久久久久天堂| 99国产精品久久久久| 精品国产91洋老外米糕| 亚洲激情六月丁香| 丰满白嫩尤物一区二区| 宅男噜噜噜66一区二区66| 国产精品久久久久久妇女6080| 日韩不卡一区二区| 成人av网站免费观看| 日韩精品一区二区三区视频播放 | 精品盗摄一区二区三区| 亚洲乱码日产精品bd | 欧美美女网站色| 久久久国产精品午夜一区ai换脸| 午夜伊人狠狠久久| 91在线精品一区二区三区| 久久夜色精品国产欧美乱极品| 亚洲一区二区精品3399| 成人免费看片app下载| 日韩精品中文字幕一区二区三区 | 亚洲午夜国产一区99re久久| 国产精选一区二区三区| 欧美一区二区私人影院日本| 亚洲丝袜美腿综合| 国产ts人妖一区二区| 欧美一区二区三区啪啪| 亚洲无人区一区| 在线观看视频91| 亚洲日穴在线视频| av激情综合网| 国产精品美女久久久久高潮| 国产乱人伦偷精品视频不卡| 欧美一级电影网站| 日韩高清中文字幕一区| 欧美日韩在线综合| 亚洲一级片在线观看| 色www精品视频在线观看| 中文字幕日本不卡| 成人动漫视频在线| 国产精品久久久久久久久久免费看 | 日本中文字幕一区二区有限公司| 在线视频一区二区三| 亚洲另类中文字| 欧美性猛交xxxxxxxx| 亚洲综合久久av| 欧美私人免费视频| 亚洲成人在线免费| 91精品国产91热久久久做人人| 午夜视频在线观看一区二区| 欧美日本一区二区三区四区| 亚洲mv在线观看| 555www色欧美视频| 久久精品噜噜噜成人av农村| 26uuu国产在线精品一区二区| 国产一区二区在线观看视频| 国产欧美一区二区精品婷婷| 成人激情综合网站| 一区二区三区丝袜| 欧美日韩的一区二区| 秋霞影院一区二区| 久久精品欧美日韩| 99国内精品久久| 午夜精品成人在线视频| 欧美一区二区三区视频| 国产精品一二三四五| 日本一区二区三区免费乱视频 | 色香蕉成人二区免费| 亚洲国产一二三| 日韩视频在线你懂得| 国产精品资源在线| 国产精品乱码一区二三区小蝌蚪| 欧美最猛黑人xxxxx猛交| 免费高清在线视频一区·| 欧美激情一区二区三区全黄| 欧美性一二三区| 国内成+人亚洲+欧美+综合在线| 亚洲欧洲99久久| 欧美一区二区在线视频|