Java Reader Read All readAll(final Reader rd)

Here you can find the source of readAll(final Reader rd)

Description

read All

License

Open Source License

Declaration

private static String readAll(final Reader rd) throws IOException 

Method Source Code

//package com.java2s;
/*/*w ww .  j a  v a 2 s. c  o m*/
 * Copyright (c) 2010 INSciTE.  All rights reserved
 * INSciTE is on the web at: http://www.hightechkids.org
 * This code is released under GPL; see LICENSE.txt for details.
 */

import java.io.IOException;

import java.io.Reader;

public class Main {
    private static String readAll(final Reader rd) throws IOException {
        StringBuilder sb = new StringBuilder();
        int cp;
        while ((cp = rd.read()) != -1) {
            sb.append((char) cp);
        }
        return sb.toString();
    }
}

Related

  1. readAll(Reader in)
  2. readAll(Reader in)
  3. readAll(Reader rd)
  4. readAll(Reader rd)