public static String writeInputStreamToString(InputStream is){
  ByteArrayOutputStream result=new ByteArrayOutputStream();
  byte[] buffer=new byte[1024];
  int length;
  try {
    while ((length=is.read(buffer)) != -1) {
      result.write(buffer,0,length);
    }
    return result.toString("UTF-8");
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

public static String writeInputStreamToString ( InputStream is ) { ByteArrayOutputStream result = new ByteArrayOutputStream ( ) ; byte [ ] buffer = new byte [ 1024 ] ; int length ; try { while ( ( length = is . read ( buffer ) ) != - 1 ) { result . write ( buffer , 0 , length ) ; } return result . toString ( "UTF-8" ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
write input stream to output stream .
