Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    private static final int BUFF_SIZE = 1024;

    private static void saveStream(InputStream is, String savePath) throws IOException {
        FileOutputStream output = new FileOutputStream(savePath);
        int readlen;

        byte[] buf = new byte[BUFF_SIZE];
        while ((readlen = is.read(buf)) > 0) {
            output.write(buf, 0, readlen);
        }
        output.close();
    }
}