Java examples for java.io:InputStream Read
get Input Stream Content
//package com.java2s; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String getInputStreamContent(InputStream stream) throws IOException { InputStreamReader in = null; StringBuffer buf = null;// w w w . j av a2 s. c o m try { buf = new StringBuffer(); in = new InputStreamReader(stream); int c; while ((c = in.read()) != -1) { buf.append((char) c); } } catch (FileNotFoundException fileNotFounfEx) { throw fileNotFounfEx; } catch (IOException ioEx) { throw ioEx; } finally { in.close(); } return buf.toString(); } }