public static String readInputStream(InputStream is,String encoding) throws IOException {
  ByteArrayOutputStream bos=null;
  try {
    bos=new ByteArrayOutputStream();
    readInputStream(bos,is);
  }
  finally {
    if (null != bos) {
      bos.close();
    }
  }
  if (null != bos) {
    return bos.toString(encoding);
  }
  return null;
}

public static String readInputStream ( InputStream is , String encoding ) throws IOException { ByteArrayOutputStream bos = null ; try { bos = new ByteArrayOutputStream ( ) ; readInputStream ( bos , is ) ; } finally { if ( null != bos ) { bos . close ( ) ; } } if ( null != bos ) { return bos . toString ( encoding ) ; } return null ; }
reads some input stream and return its content as a string .
