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;

public class Main {

    public static String getStrFromInputStream(InputStream is) {
        int i;
        char c;
        StringBuilder sb = new StringBuilder();
        try {
            while ((i = is.read()) != -1) {
                c = (char) i;
                sb.append(c);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return sb.toString();
    }
}