Java tutorial
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String toConvertString(InputStream is) { StringBuilder res = new StringBuilder(); InputStreamReader isr = new InputStreamReader(is); BufferedReader read = new BufferedReader(isr); try { String line; line = read.readLine(); while (line != null) { res.append(line).append("<br>"); line = read.readLine(); } } catch (IOException e) { e.printStackTrace(); } finally { try { isr.close(); read.close(); is.close(); } catch (IOException e) { e.printStackTrace(); } } return res.toString(); } }