Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.net.Socket;
import java.io.InputStreamReader;
import java.io.BufferedReader;

import java.io.IOException;

public class Main {
    public static String readFrom(Socket s) throws IOException {
        final BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
        StringBuilder sb = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null) {// && !inputLine.equals(RBIConstants.EOM)) {
            sb.append(inputLine);
            sb.append("\n");
        }

        in.close();
        return sb.toString();
    }
}