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

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

?? compressionresponsestream.java

?? 這是基于 XLoadTree 的一個(gè)強(qiáng)大功能的展示的例子, 文件個(gè)頭也不大, 主要功能集中在 Web 前臺(tái). 最終目標(biāo)是實(shí)現(xiàn)一個(gè)易于使用的像 Windows 資源管理器那樣管理遠(yuǎn)程 JSP
?? JAVA
字號(hào):
/*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package beansoft.compressionFilters;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.zip.GZIPOutputStream;


/**
 * Implementation of <b>ServletOutputStream</b> that works with
 * the CompressionServletResponseWrapper implementation.
 *
 * @author Amy Roh
 * @author Dmitri Valdin
 * @version $Revision: 1.3 $, $Date: 2004/03/18 16:40:28 $
 */

public class CompressionResponseStream
    extends ServletOutputStream {


    // ----------------------------------------------------------- Constructors


    /**
     * Construct a servlet output stream associated with the specified Response.
     *
     * @param response The associated response
     */
    public CompressionResponseStream(HttpServletResponse response) throws IOException{

        super();
        closed = false;
        this.response = response;
        this.output = response.getOutputStream();

    }


    // ----------------------------------------------------- Instance Variables


    /**
     * The threshold number which decides to compress or not.
     * Users can configure in web.xml to set it to fit their needs.
     */
    protected int compressionThreshold = 0;

    /**
     * Debug level
     */
    private int debug = 0;

    /**
     * The buffer through which all of our output bytes are passed.
     */
    protected byte[] buffer = null;

    /**
     * The number of data bytes currently in the buffer.
     */
    protected int bufferCount = 0;

    /**
     * The underlying gzip output stream to which we should write data.
     */
    protected GZIPOutputStream gzipstream = null;

    /**
     * Has this stream been closed?
     */
    protected boolean closed = false;

    /**
     * The content length past which we will not write, or -1 if there is
     * no defined content length.
     */
    protected int length = -1;

    /**
     * The response with which this servlet output stream is associated.
     */
    protected HttpServletResponse response = null;

    /**
     * The underlying servket output stream to which we should write data.
     */
    protected ServletOutputStream output = null;


    // --------------------------------------------------------- Public Methods

    /**
     * Set debug level
     */
    public void setDebugLevel(int debug) {
        this.debug = debug;
    }


    /**
     * Set the compressionThreshold number and create buffer for this size
     */
    protected void setBuffer(int threshold) {
        compressionThreshold = threshold;
        buffer = new byte[compressionThreshold];
        if (debug > 1) {
            System.out.println("buffer is set to "+compressionThreshold);
        }
    }

    /**
     * Close this output stream, causing any buffered data to be flushed and
     * any further output data to throw an IOException.
     */
    public void close() throws IOException {

        if (debug > 1) {
            System.out.println("close() @ CompressionResponseStream");
        }
        if (closed)
            throw new IOException("This output stream has already been closed");

        if (gzipstream != null) {
            flushToGZip();
            gzipstream.close();
            gzipstream = null;
        } else {
            if (bufferCount > 0) {
                if (debug > 2) {
                    System.out.print("output.write(");
                    System.out.write(buffer, 0, bufferCount);
                    System.out.println(")");
                }
                output.write(buffer, 0, bufferCount);
                bufferCount = 0;
            }
        }

        output.close();
        closed = true;

    }


    /**
     * Flush any buffered data for this output stream, which also causes the
     * response to be committed.
     */
    public void flush() throws IOException {

        if (debug > 1) {
            System.out.println("flush() @ CompressionResponseStream");
        }
        if (closed) {
            throw new IOException("Cannot flush a closed output stream");
        }

        if (gzipstream != null) {
            gzipstream.flush();
        }

    }

    public void flushToGZip() throws IOException {

        if (debug > 1) {
            System.out.println("flushToGZip() @ CompressionResponseStream");
        }
        if (bufferCount > 0) {
            if (debug > 1) {
                System.out.println("flushing out to GZipStream, bufferCount = " + bufferCount);
            }
            writeToGZip(buffer, 0, bufferCount);
            bufferCount = 0;
        }

    }

    /**
     * Write the specified byte to our output stream.
     *
     * @param b The byte to be written
     *
     * @exception IOException if an input/output error occurs
     */
    public void write(int b) throws IOException {

        if (debug > 1) {
            System.out.println("write "+b+" in CompressionResponseStream ");
        }
        if (closed)
            throw new IOException("Cannot write to a closed output stream");

        if (bufferCount >= buffer.length) {
            flushToGZip();
        }

        buffer[bufferCount++] = (byte) b;

    }


    /**
     * Write <code>b.length</code> bytes from the specified byte array
     * to our output stream.
     *
     * @param b The byte array to be written
     *
     * @exception IOException if an input/output error occurs
     */
    public void write(byte b[]) throws IOException {

        write(b, 0, b.length);

    }


    /**
     * Write <code>len</code> bytes from the specified byte array, starting
     * at the specified offset, to our output stream.
     *
     * @param b The byte array containing the bytes to be written
     * @param off Zero-relative starting offset of the bytes to be written
     * @param len The number of bytes to be written
     *
     * @exception IOException if an input/output error occurs
     */
    public void write(byte b[], int off, int len) throws IOException {

        if (debug > 1) {
            System.out.println("write, bufferCount = " + bufferCount + " len = " + len + " off = " + off);
        }
        if (debug > 2) {
            System.out.print("write(");
            System.out.write(b, off, len);
            System.out.println(")");
        }

        if (closed)
            throw new IOException("Cannot write to a closed output stream");

        if (len == 0)
            return;

        // Can we write into buffer ?
        if (len <= (buffer.length - bufferCount)) {
            System.arraycopy(b, off, buffer, bufferCount, len);
            bufferCount += len;
            return;
        }

        // There is not enough space in buffer. Flush it ...
        flushToGZip();

        // ... and try again. Note, that bufferCount = 0 here !
        if (len <= (buffer.length - bufferCount)) {
            System.arraycopy(b, off, buffer, bufferCount, len);
            bufferCount += len;
            return;
        }

        // write direct to gzip
        writeToGZip(b, off, len);
    }

    public void writeToGZip(byte b[], int off, int len) throws IOException {

        if (debug > 1) {
            System.out.println("writeToGZip, len = " + len);
        }
        if (debug > 2) {
            System.out.print("writeToGZip(");
            System.out.write(b, off, len);
            System.out.println(")");
        }
        if (gzipstream == null) {
            if (debug > 1) {
                System.out.println("new GZIPOutputStream");
            }
            response.addHeader("Content-Encoding", "gzip");
            gzipstream = new GZIPOutputStream(output);
        }
        gzipstream.write(b, off, len);

    }


    // -------------------------------------------------------- Package Methods


    /**
     * Has this response stream been closed?
     */
    public boolean closed() {

        return (this.closed);

    }

}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
www国产亚洲精品久久麻豆| 欧美日韩国产一二三| 国产欧美视频一区二区三区| 国产精品一区二区不卡| 国产欧美1区2区3区| 不卡一区二区中文字幕| 亚洲美女视频一区| 日韩一区二区三区电影在线观看 | 亚洲精品国产品国语在线app| 91福利在线看| 日本美女视频一区二区| 久久婷婷国产综合国色天香| 99久久久国产精品| 天天亚洲美女在线视频| 久久综合一区二区| 成人成人成人在线视频| 亚洲国产欧美在线| 国产亚洲欧美一级| 在线观看日韩精品| 国产精品一品二品| 樱花草国产18久久久久| 日韩一区二区免费电影| www.亚洲人| 日本系列欧美系列| 1区2区3区欧美| 欧美一级久久久| 91尤物视频在线观看| 男人的天堂亚洲一区| 国产精品久久久久久久久动漫 | 日韩欧美亚洲国产精品字幕久久久 | 成人综合婷婷国产精品久久蜜臀| 亚洲乱码国产乱码精品精的特点| 日韩三级在线免费观看| 成人国产一区二区三区精品| 香蕉av福利精品导航| 国产蜜臀97一区二区三区| 一本久久a久久免费精品不卡| 美女脱光内衣内裤视频久久影院| 亚洲同性gay激情无套| 精品91自产拍在线观看一区| 91成人在线免费观看| 国产又粗又猛又爽又黄91精品| 亚洲自拍偷拍麻豆| 国产精品美日韩| 精品国偷自产国产一区| 欧美久久久影院| 91网站视频在线观看| 国产精品一区二区在线看| 日韩高清不卡一区二区三区| 一区二区三区在线观看视频| 国产日韩欧美高清在线| 日韩色视频在线观看| 欧美日韩国产中文| 色综合天天综合网天天看片| 国产成人av一区二区三区在线 | 一区二区高清视频在线观看| 国产欧美日韩视频一区二区| 精品国产一区二区三区久久影院| 欧美日韩一区国产| 色狠狠桃花综合| 97久久精品人人做人人爽| 国产精品一级黄| 精品一区二区免费在线观看| 日韩综合小视频| 午夜久久久影院| 亚洲777理论| 午夜精品在线视频一区| 一区二区三区四区中文字幕| 最新中文字幕一区二区三区 | 日韩女优视频免费观看| 欧美人与性动xxxx| 欧美精品v日韩精品v韩国精品v| 欧美性一二三区| 欧美色综合久久| 欧美日韩国产精选| 在线成人午夜影院| 9191成人精品久久| 日韩欧美一区在线| 久久久久成人黄色影片| 久久网站最新地址| 国产精品美女视频| 亚洲欧洲成人精品av97| 亚洲精品国产精品乱码不99| 亚洲一卡二卡三卡四卡无卡久久| 亚洲自拍偷拍图区| 秋霞影院一区二区| 国产在线视视频有精品| 国产不卡在线播放| 亚洲精品伦理在线| 欧美国产一区在线| 国产精品麻豆一区二区| 国产精品嫩草影院av蜜臀| 国产精品久久三区| 亚洲精品美国一| 日本色综合中文字幕| 国产精品亚洲第一区在线暖暖韩国| 国产美女久久久久| 91玉足脚交白嫩脚丫在线播放| 在线亚洲欧美专区二区| 91精品国产色综合久久久蜜香臀| 日韩亚洲欧美在线观看| 欧美日韩黄视频| 日韩高清电影一区| 秋霞国产午夜精品免费视频| 国产一区在线精品| 日韩欧美国产电影| 三级精品在线观看| 青青草国产成人99久久| 99久久er热在这里只有精品66| 日本韩国精品在线| 国产精品久久久久精k8| 国产一区二区三区四区五区美女 | 欧美激情一区二区三区不卡| 免费高清成人在线| 日本高清免费不卡视频| 中文字幕精品—区二区四季| 韩国精品久久久| 欧美第一区第二区| 日本 国产 欧美色综合| 欧美日本在线一区| 亚洲国产裸拍裸体视频在线观看乱了| 91污在线观看| 中文av一区二区| 国产成人精品一区二| 久久精品夜色噜噜亚洲a∨| 麻豆精品精品国产自在97香蕉| 欧美久久久久中文字幕| 日韩成人一区二区| 欧美亚洲综合久久| 性做久久久久久| 欧美日韩一区成人| 亚洲高清中文字幕| 欧美日韩卡一卡二| 天天综合天天综合色| 在线成人av影院| 奇米四色…亚洲| 日韩一区二区三免费高清| 美女国产一区二区| 日韩欧美一区二区视频| 免播放器亚洲一区| 精品国产精品网麻豆系列| 精品一区二区三区久久| 精品国产电影一区二区| 国产成人免费xxxxxxxx| 国产精品无遮挡| 色综合久久中文综合久久牛| 亚洲老妇xxxxxx| 欧美日韩一级视频| 午夜天堂影视香蕉久久| 欧美电影精品一区二区| 国产一区二区在线观看免费| 国产欧美一区二区精品久导航 | 国产欧美日韩三级| 91在线视频播放| 亚洲午夜精品网| 欧美一区二区三区爱爱| 国产自产2019最新不卡| 中文子幕无线码一区tr| 91免费视频网址| 午夜av一区二区三区| 欧美一区二区三区公司| 国产成人综合亚洲网站| 亚洲天堂免费看| 91麻豆精品久久久久蜜臀| 极品少妇一区二区三区精品视频| 国产精品色婷婷久久58| 91麻豆免费视频| 日本中文字幕一区二区有限公司| 久久蜜桃香蕉精品一区二区三区| av一区二区三区在线| 亚洲国产日韩a在线播放性色| 精品日韩欧美在线| av不卡免费在线观看| 日本精品视频一区二区三区| 麻豆一区二区在线| 中文乱码免费一区二区| 欧美日韩国产一级片| 国产suv一区二区三区88区| 亚洲乱码国产乱码精品精小说| 日韩欧美久久久| 色哟哟欧美精品| 激情五月激情综合网| 一区二区三区资源| 精品成人在线观看| 在线观看成人免费视频| 九九精品一区二区| 一区二区三区在线不卡| 久久久久国产精品麻豆| 欧美日韩一区二区三区视频| 国产成人啪午夜精品网站男同| 亚洲一区精品在线| 中文av一区特黄| 精品少妇一区二区三区在线播放| 9l国产精品久久久久麻豆| 免费高清不卡av| 亚洲国产视频直播| 国产精品久久一级| 精品国产凹凸成av人导航| 欧美日韩一区二区三区四区 | 中文字幕亚洲一区二区av在线|