Here you can find the source of readAll(Reader reader)
Parameter | Description |
---|---|
reader | The Reader |
Parameter | Description |
---|---|
IOException | Exception in reading |
private static String readAll(Reader reader) throws IOException
//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(); } }