Java BufferedReader Read All readAll(Reader reader)

Here you can find the source of readAll(Reader reader)

Description

read All

License

Open Source License

Declaration

public static String readAll(Reader reader) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedReader;

import java.io.IOException;
import java.io.Reader;

public class Main {
    public static String readAll(Reader reader) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(reader);
        StringBuilder builder = new StringBuilder();
        String line;/*from w ww .  ja v  a2s  .  c  o  m*/
        while ((line = bufferedReader.readLine()) != null) {
            builder.append(line).append("\n");
        }
        bufferedReader.close();
        return builder.toString();
    }
}

Related

  1. readAll(InputStream in)
  2. readAll(InputStream in, String encoding)
  3. readAll(InputStream input)
  4. readAll(InputStream stream)
  5. readAll(Reader reader)
  6. readAll(Reader reader)
  7. readAll(Reader reader)
  8. readAll(String fileName)
  9. readAll(String fileName)