Java Reader Read All readAll(Reader in)

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

Description

read All

License

MIT License

Declaration

public static String readAll(Reader in) throws IOException 

Method Source Code

//package com.java2s;
/* Copyright(c) 2013 M Hata
   This software is released under the MIT License.
   http://opensource.org/licenses/mit-license.php */

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

public class Main {
    public static String readAll(Reader in) throws IOException {
        StringBuilder sb = new StringBuilder();
        while (true) {
            int c = in.read();
            if (c < 0) {
                break;
            } else {
                sb.append((char) c);
            }/*w ww  .j  a  v  a  2  s .c  o  m*/
        }
        return sb.toString();
    }
}

Related

  1. readAll(final Reader rd)
  2. readAll(Reader in)
  3. readAll(Reader rd)
  4. readAll(Reader rd)
  5. readAll(Reader rd)
  6. readAll(Reader rd)