Here you can find the source of getReader(InputStream input)
public static String getReader(InputStream input)
//package com.java2s; /* Copyright (c) 2011 by crossmobile.org * * CrossMobile is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 2. * * CrossMobile is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with CrossMobile; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *///www. ja v a 2 s.c o m import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { private final static String NL = System.getProperty("line.separator"); public static String getReader(InputStream input) { BufferedReader in = null; StringBuilder out = new StringBuilder(); try { in = new BufferedReader(new InputStreamReader(input, "UTF-8")); String line; while ((line = in.readLine()) != null) { out.append(line); out.append(NL); } return out.toString(); } catch (IOException ex) { System.err.println(ex.toString()); return null; } finally { if (in != null) try { in.close(); } catch (IOException ex) { } } } }