Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

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

public class Main {
    public static String readText(InputStream in) {
        try {
            int available = in.available();
            if (available > 0) {
                char[] text = new char[available];
                InputStreamReader reader = new InputStreamReader(in);
                int readed = reader.read(text, 0, available);
                return new String(text);
            }
        } catch (IOException e) {
        }
        return null;
    }
}