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

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

?? copyutils.java

?? < JavaME核心技術(shù)最佳實(shí)踐>>的全部源代碼
?? JAVA
字號(hào):
/*
 * Copyright 2001-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 org.apache.commons.io;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.StringReader;
import java.io.Writer;

/**
 * <p>This class provides static utility methods for buffered
 * copying between sources (<code>InputStream</code>, <code>Reader</code>,
 * <code>String</code> and <code>byte[]</code>) and destinations
 * (<code>OutputStream</code>, <code>Writer</code>, <code>String</code> and
 * <code>byte[]</code>).</p>
 *
 * <p>Unless otherwise noted, these <code>copy</code> methods do <em>not</em>
 * flush or close the streams. Often doing so would require making non-portable
 * assumptions about the streams' origin and further use. This means that both
 * streams' <code>close()</code> methods must be called after copying. if one
 * omits this step, then the stream resources (sockets, file descriptors) are
 * released when the associated Stream is garbage-collected. It is not a good
 * idea to rely on this mechanism. For a good overview of the distinction
 * between "memory management" and "resource management", see
 * <a href="http://www.unixreview.com/articles/1998/9804/9804ja/ja.htm">this
 * UnixReview article</a>.</p>
 *
 * <p>For byte-to-char methods, a <code>copy</code> variant allows the encoding
 * to be selected (otherwise the platform default is used). We would like to
 * encourage you to always specify the encoding because relying on the platform
 * default can lead to unexpected results.</p>
 *
 * <p>We don't provide special variants for the <code>copy</code> methods that
 * let you specify the buffer size because in modern VMs the impact on speed
 * seems to be minimal. We're using a default buffer size of 4 KB.</p>
 *
 * <p>The <code>copy</code> methods use an internal buffer when copying. It is
 * therefore advisable <em>not</em> to deliberately wrap the stream arguments
 * to the <code>copy</code> methods in <code>Buffered*</code> streams. For
 * example, don't do the following:</p>
 *
 * <code>copy( new BufferedInputStream( in ),
 *   new BufferedOutputStream( out ) );</code>
 *
 * <p>The rationale is as follows:</p>
 *
 * <p>Imagine that an InputStream's read() is a very expensive operation, which
 * would usually suggest wrapping in a BufferedInputStream. The
 * BufferedInputStream works by issuing infrequent
 * {@link java.io.InputStream#read(byte[] b, int off, int len)} requests on the
 * underlying InputStream, to fill an internal buffer, from which further
 * <code>read</code> requests can inexpensively get their data (until the buffer
 * runs out).</p>
 *
 * <p>However, the <code>copy</code> methods do the same thing, keeping an
 * internal buffer, populated by
 * {@link InputStream#read(byte[] b, int off, int len)} requests. Having two
 * buffers (or three if the destination stream is also buffered) is pointless,
 * and the unnecessary buffer management hurts performance slightly (about 3%,
 * according to some simple experiments).</p>
 *
 * <p>Behold, intrepid explorers; a map of this class:</p>
 * <pre>
 *       Method      Input               Output          Dependency
 *       ------      -----               ------          -------
 * 1     copy        InputStream         OutputStream    (primitive)
 * 2     copy        Reader              Writer          (primitive)
 *
 * 3     copy        InputStream         Writer          2
 *
 * 4     copy        Reader              OutputStream    2
 *
 * 5     copy        String              OutputStream    2
 * 6     copy        String              Writer          (trivial)
 *
 * 7     copy        byte[]              Writer          3
 * 8     copy        byte[]              OutputStream    (trivial)
 * </pre>
 *
 * <p>Note that only the first two methods shuffle bytes; the rest use these
 * two, or (if possible) copy using native Java copy methods. As there are
 * method variants to specify the encoding, each row may
 * correspond to up to 2 methods.</p>
 *
 * <p>Origin of code: Excalibur.</p>
 *
 * @author Peter Donald
 * @author Jeff Turner
 * @author Matthew Hawthorne
 * @version $Id: CopyUtils.java 289999 2005-09-18 23:12:45Z scolebourne $
 * @deprecated Use IOUtils. Will be removed in 2.0.
 *  Methods renamed to IOUtils.write() or IOUtils.copy().
 *  Null handling behaviour changed in IOUtils (null data does not
 *  throw NullPointerException).
 */
public class CopyUtils {

    /**
     * The default size of the buffer.
     */
    private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;

    /**
     * Instances should NOT be constructed in standard programming.
     */
    public CopyUtils() { }

    // ----------------------------------------------------------------
    // byte[] -> OutputStream
    // ----------------------------------------------------------------

    /**
     * Copy bytes from a <code>byte[]</code> to an <code>OutputStream</code>.
     * @param input the byte array to read from
     * @param output the <code>OutputStream</code> to write to
     * @throws IOException In case of an I/O problem
     */
    public static void copy(byte[] input, OutputStream output)
            throws IOException {
        output.write(input);
    }

    // ----------------------------------------------------------------
    // byte[] -> Writer
    // ----------------------------------------------------------------

    /**
     * Copy and convert bytes from a <code>byte[]</code> to chars on a
     * <code>Writer</code>.
     * The platform's default encoding is used for the byte-to-char conversion.
     * @param input the byte array to read from
     * @param output the <code>Writer</code> to write to
     * @throws IOException In case of an I/O problem
     */
    public static void copy(byte[] input, Writer output)
            throws IOException {
        ByteArrayInputStream in = new ByteArrayInputStream(input);
        copy(in, output);
    }


    /**
     * Copy and convert bytes from a <code>byte[]</code> to chars on a
     * <code>Writer</code>, using the specified encoding.
     * @param input the byte array to read from
     * @param output the <code>Writer</code> to write to
     * @param encoding The name of a supported character encoding. See the
     * <a href="http://www.iana.org/assignments/character-sets">IANA
     * Charset Registry</a> for a list of valid encoding types.
     * @throws IOException In case of an I/O problem
     */
    public static void copy(
            byte[] input,
            Writer output,
            String encoding)
                throws IOException {
        ByteArrayInputStream in = new ByteArrayInputStream(input);
        copy(in, output, encoding);
    }


    // ----------------------------------------------------------------
    // Core copy methods
    // ----------------------------------------------------------------

    /**
     * Copy bytes from an <code>InputStream</code> to an
     * <code>OutputStream</code>.
     * @param input the <code>InputStream</code> to read from
     * @param output the <code>OutputStream</code> to write to
     * @return the number of bytes copied
     * @throws IOException In case of an I/O problem
     */
    public static int copy(
            InputStream input,
            OutputStream output)
                throws IOException {
        byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
        int count = 0;
        int n = 0;
        while (-1 != (n = input.read(buffer))) {
            output.write(buffer, 0, n);
            count += n;
        }
        return count;
    }

    // ----------------------------------------------------------------
    // Reader -> Writer
    // ----------------------------------------------------------------

    /**
     * Copy chars from a <code>Reader</code> to a <code>Writer</code>.
     * @param input the <code>Reader</code> to read from
     * @param output the <code>Writer</code> to write to
     * @return the number of characters copied
     * @throws IOException In case of an I/O problem
     */
    public static int copy(
            Reader input,
            Writer output)
                throws IOException {
        char[] buffer = new char[DEFAULT_BUFFER_SIZE];
        int count = 0;
        int n = 0;
        while (-1 != (n = input.read(buffer))) {
            output.write(buffer, 0, n);
            count += n;
        }
        return count;
    }

    // ----------------------------------------------------------------
    // InputStream -> Writer
    // ----------------------------------------------------------------

    /**
     * Copy and convert bytes from an <code>InputStream</code> to chars on a
     * <code>Writer</code>.
     * The platform's default encoding is used for the byte-to-char conversion.
     * @param input the <code>InputStream</code> to read from
     * @param output the <code>Writer</code> to write to
     * @throws IOException In case of an I/O problem
     */
    public static void copy(
            InputStream input,
            Writer output)
                throws IOException {
        InputStreamReader in = new InputStreamReader(input);
        copy(in, output);
    }

    /**
     * Copy and convert bytes from an <code>InputStream</code> to chars on a
     * <code>Writer</code>, using the specified encoding.
     * @param input the <code>InputStream</code> to read from
     * @param output the <code>Writer</code> to write to
     * @param encoding The name of a supported character encoding. See the
     * <a href="http://www.iana.org/assignments/character-sets">IANA
     * Charset Registry</a> for a list of valid encoding types.
     * @throws IOException In case of an I/O problem
     */
    public static void copy(
            InputStream input,
            Writer output,
            String encoding)
                throws IOException {
        InputStreamReader in = new InputStreamReader(input, encoding);
        copy(in, output);
    }


    // ----------------------------------------------------------------
    // Reader -> OutputStream
    // ----------------------------------------------------------------

    /**
     * Serialize chars from a <code>Reader</code> to bytes on an
     * <code>OutputStream</code>, and flush the <code>OutputStream</code>.
     * @param input the <code>Reader</code> to read from
     * @param output the <code>OutputStream</code> to write to
     * @throws IOException In case of an I/O problem
     */
    public static void copy(
            Reader input,
            OutputStream output)
                throws IOException {
        OutputStreamWriter out = new OutputStreamWriter(output);
        copy(input, out);
        // XXX Unless anyone is planning on rewriting OutputStreamWriter, we
        // have to flush here.
        out.flush();
    }

    // ----------------------------------------------------------------
    // String -> OutputStream
    // ----------------------------------------------------------------

    /**
     * Serialize chars from a <code>String</code> to bytes on an
     * <code>OutputStream</code>, and
     * flush the <code>OutputStream</code>.
     * @param input the <code>String</code> to read from
     * @param output the <code>OutputStream</code> to write to
     * @throws IOException In case of an I/O problem
     */
    public static void copy(
            String input,
            OutputStream output)
                throws IOException {
        StringReader in = new StringReader(input);
        OutputStreamWriter out = new OutputStreamWriter(output);
        copy(in, out);
        // XXX Unless anyone is planning on rewriting OutputStreamWriter, we
        // have to flush here.
        out.flush();
    }

    // ----------------------------------------------------------------
    // String -> Writer
    // ----------------------------------------------------------------

    /**
     * Copy chars from a <code>String</code> to a <code>Writer</code>.
     * @param input the <code>String</code> to read from
     * @param output the <code>Writer</code> to write to
     * @throws IOException In case of an I/O problem
     */
    public static void copy(String input, Writer output)
                throws IOException {
        output.write(input);
    }

}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美另类小说视频| 亚洲精品综合在线| 91高清视频在线| 美国av一区二区| 一区二区三区国产精品| 久久一二三国产| 日韩精品中文字幕在线不卡尤物| 成人动漫视频在线| 麻豆传媒一区二区三区| 一区二区三区四区视频精品免费| 久久综合九色欧美综合狠狠| 欧美精品一二三区| 99视频一区二区三区| 韩国一区二区视频| 亚洲午夜影视影院在线观看| 国产精品久久久久一区二区三区共| 91精品国产入口| 欧美在线播放高清精品| 成人av电影免费在线播放| 国产精品中文字幕一区二区三区| 亚洲.国产.中文慕字在线| 亚洲伦在线观看| 国产精品福利影院| 国产亚洲短视频| 亚洲精品在线观看网站| 欧美一级高清大全免费观看| 日本高清不卡aⅴ免费网站| 波波电影院一区二区三区| 国产一区二区三区不卡在线观看| 免费日本视频一区| 午夜av电影一区| 亚洲成人自拍网| 亚州成人在线电影| 丝袜美腿一区二区三区| 亚洲成人动漫在线免费观看| 亚洲一区二区三区国产| 亚洲一区成人在线| 亚洲一区二区三区四区中文字幕| 亚洲毛片av在线| 亚洲一区二区三区在线| 亚洲一级二级三级在线免费观看| 一区二区三区在线视频观看58 | 在线免费观看日韩欧美| a亚洲天堂av| 97精品电影院| 色伊人久久综合中文字幕| 色香蕉成人二区免费| 91蜜桃在线观看| 欧洲另类一二三四区| 欧美视频一区二区三区四区| 欧美三级视频在线| 欧美猛男男办公室激情| 欧美一区午夜视频在线观看 | 国产日产精品1区| 国产日本一区二区| 亚洲日本中文字幕区| 亚洲精品自拍动漫在线| 亚洲国产成人av网| 日本aⅴ免费视频一区二区三区| 免费成人在线视频观看| 国产乱一区二区| av电影天堂一区二区在线 | 久久这里只有精品视频网| 26uuu国产在线精品一区二区| 久久九九久久九九| 亚洲男人电影天堂| 视频在线观看91| 国产风韵犹存在线视精品| 94-欧美-setu| 91麻豆精品国产91久久久久久| 2021国产精品久久精品| 亚洲大片一区二区三区| 蜜桃视频在线观看一区| 丰满少妇久久久久久久| 色噜噜狠狠色综合中国| 欧美一卡二卡在线观看| 欧美韩日一区二区三区| 亚洲综合免费观看高清在线观看| 日韩国产精品久久| 国产91精品露脸国语对白| 色激情天天射综合网| 日韩欧美123| 亚洲日本欧美天堂| 欧美a一区二区| 成人黄色777网| 在线电影国产精品| 中文字幕在线视频一区| 日韩高清不卡在线| 成人一区二区三区视频在线观看 | 国产视频视频一区| 亚洲一区二区精品久久av| 国内不卡的二区三区中文字幕| 色综合视频一区二区三区高清| 日韩一级大片在线观看| 亚洲嫩草精品久久| 国产精品一区2区| 在线成人免费视频| 国产精品欧美经典| 久久99国产精品免费网站| 91国产丝袜在线播放| 国产婷婷一区二区| 日本亚洲免费观看| 91久久精品午夜一区二区| 久久久三级国产网站| 日韩精品乱码av一区二区| 成人黄色一级视频| 精品国产91亚洲一区二区三区婷婷| 综合欧美亚洲日本| 国产99久久久国产精品免费看 | 欧美日韩一区二区三区免费看| 久久蜜桃av一区精品变态类天堂| 亚洲一区二区三区四区五区黄 | 一区二区三区在线观看国产 | 欧美日韩国产天堂| 18欧美乱大交hd1984| 国产精品自拍网站| 日韩无一区二区| 午夜精彩视频在线观看不卡| 色综合视频一区二区三区高清| 中文字幕欧美激情| 国产成人亚洲综合a∨婷婷图片| 国产欧美一区二区精品仙草咪| 视频在线观看国产精品| 色狠狠桃花综合| 亚洲你懂的在线视频| 97精品超碰一区二区三区| 欧美国产亚洲另类动漫| 国产大陆a不卡| 久久久精品tv| 国产精品1区2区| 国产欧美日韩精品在线| 九九在线精品视频| 精品国产91乱码一区二区三区| 国产在线精品免费| 国产亚洲成av人在线观看导航| 久久99久久99| 久久综合给合久久狠狠狠97色69| 久久国产成人午夜av影院| 欧美刺激午夜性久久久久久久| 日本在线不卡视频| 欧美成人伊人久久综合网| 国产在线一区观看| 国产丝袜欧美中文另类| 成人av第一页| 亚洲乱码精品一二三四区日韩在线| 色哟哟一区二区在线观看| 亚洲国产精品久久久久秋霞影院| 欧美裸体一区二区三区| 久久精品国产精品亚洲精品| 久久婷婷国产综合精品青草| 国产成人精品三级| 亚洲欧美综合网| 在线影院国内精品| 天天操天天干天天综合网| 69p69国产精品| 老色鬼精品视频在线观看播放| 欧美一区二区视频在线观看2020| 免费高清不卡av| 26uuu亚洲综合色| 国产精品中文字幕日韩精品| 久久久久久久久99精品| 97久久精品人人做人人爽| 日韩理论在线观看| 色婷婷国产精品| 中文字幕欧美日本乱码一线二线| 91视频免费看| 亚洲国产视频在线| 91精品国产欧美一区二区成人| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 久久成人综合网| 国产婷婷一区二区| caoporn国产一区二区| 国产精品久久久久久久久快鸭| 欧美午夜一区二区三区| 日本在线不卡一区| 久久女同精品一区二区| 激情文学综合网| 亚洲综合色成人| 精品久久久久久久久久久院品网 | 国内成人免费视频| 中文文精品字幕一区二区| 成人小视频在线| 一区二区三区在线观看视频| 69av一区二区三区| 成人久久视频在线观看| 亚洲图片欧美综合| 精品国产91乱码一区二区三区 | 国产精品拍天天在线| 91极品视觉盛宴| 国产成人精品免费一区二区| 亚洲欧美另类小说视频| 欧美一区国产二区| 国产成人高清视频| 五月天久久比比资源色| 久久精品欧美日韩| 欧美日韩夫妻久久| 色综合久久88色综合天天6 | 久久久美女毛片| 在线日韩av片| 久久97超碰色|