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

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

?? ioutils.java

?? < JavaME核心技術最佳實踐>>的全部源代碼
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
/*
 * Copyright 2001-2006 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.BufferedInputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.CharArrayWriter;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.apache.commons.io.output.ByteArrayOutputStream;

/**
 * General IO stream manipulation utilities.
 * <p>
 * This class provides static utility methods for input/output operations.
 * <ul>
 * <li>closeQuietly - these methods close a stream ignoring nulls and exceptions
 * <li>toXxx/read - these methods read data from a stream
 * <li>write - these methods write data to a stream
 * <li>copy - these methods copy all the data from one stream to another
 * <li>contentEquals - these methods compare the content of two streams
 * </ul>
 * <p>
 * The byte-to-char methods and char-to-byte methods involve a conversion step.
 * Two methods are provided in each case, one that uses the platform default
 * encoding and the other which allows you to specify an encoding. You are
 * encouraged to always specify an encoding because relying on the platform
 * default can lead to unexpected results, for example when moving from
 * development to production.
 * <p>
 * All the methods in this class that read a stream are buffered internally.
 * This means that there is no cause to use a <code>BufferedInputStream</code>
 * or <code>BufferedReader</code>. The default buffer size of 4K has been shown
 * to be efficient in tests.
 * <p>
 * Wherever possible, the methods in this class do <em>not</em> flush or close
 * the stream. This is to avoid making non-portable assumptions about the
 * streams' origin and further use. Thus the caller is still responsible for
 * closing streams after use.
 * <p>
 * Origin of code: Excalibur.
 *
 * @author Peter Donald
 * @author Jeff Turner
 * @author Matthew Hawthorne
 * @author Stephen Colebourne
 * @author Gareth Davis
 * @author Ian Springer
 * @author Niall Pemberton
 * @author Sandy McArthur
 * @version $Id: IOUtils.java 385117 2006-03-11 18:07:02Z scolebourne $
 */
public class IOUtils {
    // NOTE: This class is focussed on InputStream, OutputStream, Reader and
    // Writer. Each method should take at least one of these as a parameter,
    // or return one of them.

    /**
     * The Unix directory separator character.
     */
    public static final char DIR_SEPARATOR_UNIX = '/';
    /**
     * The Windows directory separator character.
     */
    public static final char DIR_SEPARATOR_WINDOWS = '\\';
    /**
     * The system directory separator character.
     */
    public static final char DIR_SEPARATOR = File.separatorChar;
    /**
     * The Unix line separator string.
     */
    public static final String LINE_SEPARATOR_UNIX = "\n";
    /**
     * The Windows line separator string.
     */
    public static final String LINE_SEPARATOR_WINDOWS = "\r\n";
    /**
     * The system line separator string.
     */
    public static final String LINE_SEPARATOR;
    static {
        // avoid security issues
        StringWriter buf = new StringWriter(4);
        PrintWriter out = new PrintWriter(buf);
        out.println();
        LINE_SEPARATOR = buf.toString();
    }

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

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

    //-----------------------------------------------------------------------
    /**
     * Unconditionally close an <code>Reader</code>.
     * <p>
     * Equivalent to {@link Reader#close()}, except any exceptions will be ignored.
     * This is typically used in finally blocks.
     *
     * @param input  the Reader to close, may be null or already closed
     */
    public static void closeQuietly(Reader input) {
        try {
            if (input != null) {
                input.close();
            }
        } catch (IOException ioe) {
            // ignore
        }
    }

    /**
     * Unconditionally close a <code>Writer</code>.
     * <p>
     * Equivalent to {@link Writer#close()}, except any exceptions will be ignored.
     * This is typically used in finally blocks.
     *
     * @param output  the Writer to close, may be null or already closed
     */
    public static void closeQuietly(Writer output) {
        try {
            if (output != null) {
                output.close();
            }
        } catch (IOException ioe) {
            // ignore
        }
    }

    /**
     * Unconditionally close an <code>InputStream</code>.
     * <p>
     * Equivalent to {@link InputStream#close()}, except any exceptions will be ignored.
     * This is typically used in finally blocks.
     *
     * @param input  the InputStream to close, may be null or already closed
     */
    public static void closeQuietly(InputStream input) {
        try {
            if (input != null) {
                input.close();
            }
        } catch (IOException ioe) {
            // ignore
        }
    }

    /**
     * Unconditionally close an <code>OutputStream</code>.
     * <p>
     * Equivalent to {@link OutputStream#close()}, except any exceptions will be ignored.
     * This is typically used in finally blocks.
     *
     * @param output  the OutputStream to close, may be null or already closed
     */
    public static void closeQuietly(OutputStream output) {
        try {
            if (output != null) {
                output.close();
            }
        } catch (IOException ioe) {
            // ignore
        }
    }

    // read toByteArray
    //-----------------------------------------------------------------------
    /**
     * Get the contents of an <code>InputStream</code> as a <code>byte[]</code>.
     * <p>
     * This method buffers the input internally, so there is no need to use a
     * <code>BufferedInputStream</code>.
     * 
     * @param input  the <code>InputStream</code> to read from
     * @return the requested byte array
     * @throws NullPointerException if the input is null
     * @throws IOException if an I/O error occurs
     */
    public static byte[] toByteArray(InputStream input) throws IOException {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        copy(input, output);
        return output.toByteArray();
    }

    /**
     * Get the contents of a <code>Reader</code> as a <code>byte[]</code>
     * using the default character encoding of the platform.
     * <p>
     * This method buffers the input internally, so there is no need to use a
     * <code>BufferedReader</code>.
     * 
     * @param input  the <code>Reader</code> to read from
     * @return the requested byte array
     * @throws NullPointerException if the input is null
     * @throws IOException if an I/O error occurs
     */
    public static byte[] toByteArray(Reader input) throws IOException {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        copy(input, output);
        return output.toByteArray();
    }

    /**
     * Get the contents of a <code>Reader</code> as a <code>byte[]</code>
     * using the specified character encoding.
     * <p>
     * Character encoding names can be found at
     * <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
     * <p>
     * This method buffers the input internally, so there is no need to use a
     * <code>BufferedReader</code>.
     * 
     * @param input  the <code>Reader</code> to read from
     * @param encoding  the encoding to use, null means platform default
     * @return the requested byte array
     * @throws NullPointerException if the input is null
     * @throws IOException if an I/O error occurs
     * @since Commons IO 1.1
     */
    public static byte[] toByteArray(Reader input, String encoding)
            throws IOException {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        copy(input, output, encoding);
        return output.toByteArray();
    }

    /**
     * Get the contents of a <code>String</code> as a <code>byte[]</code>
     * using the default character encoding of the platform.
     * <p>
     * This is the same as {@link String#getBytes()}.
     * 
     * @param input  the <code>String</code> to convert
     * @return the requested byte array
     * @throws NullPointerException if the input is null
     * @throws IOException if an I/O error occurs (never occurs)
     * @deprecated Use {@link String#getBytes()}
     */
    public static byte[] toByteArray(String input) throws IOException {
        return input.getBytes();
    }

    // read char[]
    //-----------------------------------------------------------------------
    /**
     * Get the contents of an <code>InputStream</code> as a character array
     * using the default character encoding of the platform.
     * <p>
     * This method buffers the input internally, so there is no need to use a
     * <code>BufferedInputStream</code>.
     * 
     * @param is  the <code>InputStream</code> to read from
     * @return the requested character array
     * @throws NullPointerException if the input is null
     * @throws IOException if an I/O error occurs
     * @since Commons IO 1.1
     */
    public static char[] toCharArray(InputStream is) throws IOException {
        CharArrayWriter output = new CharArrayWriter();
        copy(is, output);
        return output.toCharArray();
    }

    /**
     * Get the contents of an <code>InputStream</code> as a character array
     * using the specified character encoding.
     * <p>
     * Character encoding names can be found at
     * <a href="http://www.iana.org/assignments/character-sets">IANA</a>.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲综合视频在线| 亚洲精品一区二区三区99| 午夜精品影院在线观看| 欧美电视剧在线看免费| 在线日韩av片| 欧美精品黑人性xxxx| 在线观看一区日韩| 欧美精品色综合| 精品国一区二区三区| 精品国产亚洲一区二区三区在线观看| 欧美区视频在线观看| 日韩三级精品电影久久久| 久久众筹精品私拍模特| 国产精品午夜春色av| 亚洲一级电影视频| 日韩av不卡在线观看| 国产福利一区二区三区视频| 国产精品一区二区不卡| 色天天综合久久久久综合片| 欧美精品成人一区二区三区四区| 欧美日韩黄色一区二区| 精品裸体舞一区二区三区| 亚洲视频一二区| 蜜桃一区二区三区在线观看| 成人性色生活片| 欧美性xxxxxx少妇| 国产亚洲精品久| 免费观看在线综合| 97se亚洲国产综合自在线不卡| 欧美日韩一区二区三区在线| 欧美成人性福生活免费看| 亚洲狠狠丁香婷婷综合久久久| 捆绑调教美女网站视频一区| 日本二三区不卡| 久久久www成人免费无遮挡大片| 亚洲伊人色欲综合网| 成人永久aaa| 久久久不卡影院| 久色婷婷小香蕉久久| 欧美三级三级三级| 亚洲色欲色欲www| av一区二区三区四区| 久久精品一区二区三区不卡牛牛| 性欧美疯狂xxxxbbbb| 国产91清纯白嫩初高中在线观看| 欧美日韩国产美女| 亚洲日本在线天堂| 91在线你懂得| 午夜免费久久看| 日韩一区二区麻豆国产| 亚洲国产欧美在线| 欧美色综合网站| 美女视频免费一区| 精品第一国产综合精品aⅴ| 韩国成人在线视频| 国产日韩精品一区| 91精品国产综合久久久久久久久久| 成人一区二区三区中文字幕| 日韩精品在线网站| 成人免费精品视频| 亚洲国产日韩在线一区模特| 日韩免费观看高清完整版 | 成人免费一区二区三区视频| 99视频精品在线| 亚洲欧美偷拍三级| 精品国产制服丝袜高跟| 91免费在线播放| 玖玖九九国产精品| 亚洲一区二区三区四区在线免费观看| 在线精品视频一区二区| 国产精品66部| 日本大胆欧美人术艺术动态| 国产亚洲一二三区| 欧美一区二区私人影院日本| 91麻豆文化传媒在线观看| 国产69精品久久777的优势| 亚洲少妇屁股交4| 国产日韩欧美电影| 欧美日韩精品免费| 91国产免费看| 欧洲av一区二区嗯嗯嗯啊| 波多野结衣中文一区| 成人在线综合网站| 成年人网站91| www.日韩精品| 色老汉av一区二区三区| 色婷婷综合久久| 欧美无砖砖区免费| 制服丝袜亚洲网站| 欧美刺激脚交jootjob| 久久综合999| 亚洲国产成人在线| 亚洲欧美视频一区| 亚洲va国产天堂va久久en| 日本在线不卡一区| 国产精品自拍网站| 国产99精品视频| 91网站在线观看视频| 欧美午夜免费电影| 91精品欧美久久久久久动漫| 欧美大片日本大片免费观看| 国产亚洲精品福利| 一区二区三区在线播| 天天色天天操综合| 国产精品免费视频网站| 日韩女优制服丝袜电影| 国产欧美一区二区精品久导航| 日韩欧美国产电影| 亚洲精品一线二线三线| 国产婷婷色一区二区三区四区 | 成人毛片老司机大片| 国产一区二区三区av电影| 国产91露脸合集magnet| 欧美美女bb生活片| 国产日韩高清在线| 亚洲视频在线一区观看| 天天综合天天做天天综合| 国产电影一区在线| 不卡区在线中文字幕| 欧美日韩一区二区三区免费看| 亚洲精品在线三区| 一区二区三区日本| 国产精品中文字幕欧美| 日本电影欧美片| 久久久久久久久久久久久久久99 | 99久久伊人久久99| 欧美日韩在线播| 国产三级久久久| 亚洲国产精品久久久久秋霞影院| 国产精品一区二区三区乱码| 欧美亚洲另类激情小说| 国产亚洲自拍一区| 日韩中文字幕亚洲一区二区va在线 | 日韩一级成人av| 亚洲乱码日产精品bd| 国产精品自产自拍| 3d成人h动漫网站入口| 一区二区高清在线| 北条麻妃一区二区三区| www日韩大片| 麻豆精品在线播放| 欧美精品第一页| 一区二区高清视频在线观看| 国产高清精品网站| 精品国产制服丝袜高跟| 三级影片在线观看欧美日韩一区二区 | 中文字幕亚洲区| 国产一区二区在线观看免费| 欧美老年两性高潮| 亚洲一区二区精品久久av| eeuss影院一区二区三区| 国产亚洲午夜高清国产拍精品| 奇米777欧美一区二区| 9191国产精品| 性做久久久久久久久| 欧洲另类一二三四区| 亚洲精选一二三| 99re在线视频这里只有精品| 欧美经典三级视频一区二区三区| 国产一区二区三区在线观看免费 | 制服丝袜av成人在线看| 亚洲一区二三区| 在线观看免费视频综合| 亚洲少妇最新在线视频| 91视频91自| 亚洲乱码国产乱码精品精98午夜 | 国产最新精品免费| 欧美成人猛片aaaaaaa| 麻豆国产91在线播放| 日韩一级黄色片| 蜜桃久久精品一区二区| 欧美一三区三区四区免费在线看 | 国产精品白丝jk白祙喷水网站| 精品国产三级a在线观看| 韩国成人福利片在线播放| 久久网站最新地址| 国产精品一二一区| 国产精品久久久久久久久搜平片 | 蜜臀av性久久久久蜜臀aⅴ四虎 | 久久综合一区二区| 国产成+人+日韩+欧美+亚洲| 国产亚洲一区二区三区| 不卡电影一区二区三区| 亚洲精品国产a久久久久久| 欧美三级电影精品| 美国毛片一区二区三区| 久久婷婷色综合| 99re视频精品| 亚洲国产精品人人做人人爽| 在线播放日韩导航| 国产一区二区三区四区五区入口 | 337p粉嫩大胆噜噜噜噜噜91av| 国产精品自在欧美一区| 亚洲欧美另类久久久精品2019| 欧美日韩国产123区| 国产一区二区日韩精品| 国产精品不卡在线观看| 欧美日韩视频专区在线播放| 美日韩一区二区三区| 国产欧美综合在线观看第十页|