Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.BufferedInputStream;

import java.io.BufferedReader;

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

public class Main {
    public static String toString(InputStream in) throws IOException {
        if (in == null) {
            return null;
        }
        BufferedReader br = new BufferedReader(new InputStreamReader(new BufferedInputStream(in, 8 * 1024)));
        StringBuilder result = new StringBuilder();
        String line = null;
        while ((line = br.readLine()) != null) {
            result.append(line);
        }
        return result.toString();
    }
}