Java tutorial
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.io.Reader; public class Main { /** * Slurps a Reader into a String and strips the character 0. * @param in * @throws IOException */ public static String readerToPrintableCharString(final Reader in) throws IOException { StringBuffer out = new StringBuffer(); int n; while ((n = in.read()) != -1) { if (n != 0) { char c = (char) n; out.append(c); } } return out.toString(); } }