Java BufferedReader Read All ReadAllFromStream(InputStream source)

Here you can find the source of ReadAllFromStream(InputStream source)

Description

Read All From Stream

License

LGPL

Declaration

public static String ReadAllFromStream(InputStream source) throws IOException 

Method Source Code


//package com.java2s;
//License from project: LGPL 

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

public class Main {
    public static String ReadAllFromStream(InputStream source) throws IOException {

        StringBuilder sb = new StringBuilder();

        BufferedReader br = new BufferedReader(new InputStreamReader(source));

        String line;//w ww .j  av a  2  s.co m
        while ((line = br.readLine()) != null) {

            sb.append(line).append("\n");

        }

        return sb.toString();

    }
}

Related

  1. readAllCourseNum()
  2. readAllCoursePro()
  3. readAllCourseTime()
  4. readAllFromInputStream(InputStream inputStream)
  5. readAllFromInputStreamAsList(InputStream inputStream)
  6. readAllLines(File file)
  7. readAllLines(File file)
  8. readAllLines(InputStream inputStream)
  9. readAllLines(InputStream is)