Java Reader Read All readAll(Reader reader)

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

Description

Connection Reader.

License

Open Source License

Parameter

Parameter Description
reader The Reader

Exception

Parameter Description
IOException Exception in reading

Return

the message red

Declaration

private static String readAll(Reader reader) throws IOException

    

Method Source Code

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

import java.io.IOException;

import java.io.Reader;

public class Main {
    /**//from w ww .j  ava 2s . co m
     * Connection Reader.
     * 
     * @param reader
     *          The Reader
     * @return the message red
     * @throws IOException
     *           Exception in reading
     */
    private static String readAll(Reader reader) throws IOException

    {
        StringBuilder sb = new StringBuilder();
        int cp;
        while ((cp = reader.read()) != -1) {
            sb.append((char) cp);
        }
        return sb.toString();
    }
}

Related

  1. readAll(Reader rd)
  2. readAll(Reader rd)
  3. readAll(Reader rd)
  4. readAll(Reader reader)
  5. readAll(Reader reader)
  6. ReadAll_Variant1(Reader rd, Writer wr)
  7. readAllChars(Reader reader)
  8. readAllChars(Reader reader)
  9. readAllCharsAndClose(Reader reader)