Java tutorial
//package com.java2s; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; public class Main { private static String isStreamString(InputStream is) { ByteArrayOutputStream bo = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int len = -1; try { while ((len = is.read(buf)) != -1) { bo.write(buf, 0, len); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if (is != null) try { is.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return replaceBr(new String(bo.toByteArray())); } public static String replaceBr(String old) { return old.replace("\\021", "\\r\\n"); } }