Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.IOException;
import java.io.InputStream;

import java.io.OutputStream;

public class Main {
    public static void streamToStream(InputStream is, OutputStream os) throws IOException {
        final byte[] buffer = new byte[256];
        try {
            int n;
            while ((n = is.read(buffer)) != -1) {
                os.write(buffer, 0, n);
            }
        } finally {
            os.flush();
            os.close();
            is.close();
        }
    }
}