Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

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

public class Main {

    public static String InputStreamToString(InputStream is) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
        StringBuilder sb = new StringBuilder();
        String line = null;
        try {
            while ((line = reader.readLine()) != null) {
                sb.append(line);
                line = null;
            }
        } finally {
            //            FileLocalCache.closeBufferedReader(reader);
        }
        line = sb.toString();
        sb = null;
        return line;
    }
}