集册 Java实例教程 将数据从一个流复制到另一个流

将数据从一个流复制到另一个流

欢马劈雪     最近更新时间:2020-01-02 10:19:05

724
将数据从一个流复制到另一个

/**

 * e-Science Central

 * Copyright (C) 2008-2013 School of Computing Science, Newcastle University

 *

 * This program is free software; you can redistribute it and/or

 * modify it under the terms of the GNU General Public License

 * version 2 as published by the Free Software Foundation at:

 * http://www.gnu.org/licenses/gpl-2.0.html

 *

 * This program is distributed in the hope that it will be useful,

 * but WITHOUT ANY WARRANTY; without even the implied warranty of

 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

 * GNU General Public License for more details.

 *

 * You should have received a copy of the GNU General Public License

 * along with this program; if not, write to the Free Software

 * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, USA.

 */

//package com.nowjava;
/**
来 自 时 代 J a v a 公 众 号 - nowjava.com
**/

import java.io.*;


public class Main {

    /** Copy the data from one stream to another */

    public static final void copyInputStream(InputStream in,

            OutputStream out) throws IOException {

        byte[] buffer = new byte[4096];

        
展开阅读全文