private synchronized String readInputStream(InputStreamReader inputStreamReader) throws IOException, BadLocationException {
  BufferedReader bufferedReader=null;
  try {
    bufferedReader=new BufferedReader(inputStreamReader);
    String newLine="\n";
    StringBuffer sb=new StringBuffer();
    String line;
    while ((line=bufferedReader.readLine()) != null) {
      sb.append(line + newLine);
    }
    return sb.toString();
  }
  finally {
    if (null != bufferedReader)     bufferedReader.close();
    if (null != inputStreamReader)     inputStreamReader.close();
  }
}

private synchronized String readInputStream ( InputStreamReader inputStreamReader ) throws IOException , BadLocationException { BufferedReader bufferedReader = null ; try { bufferedReader = new BufferedReader ( inputStreamReader ) ; String newLine = "\n" ; StringBuffer sb = new StringBuffer ( ) ; String line ; while ( ( line = bufferedReader . readLine ( ) ) != null ) { sb . append ( line + newLine ) ; } return sb . toString ( ) ; } finally { if ( null != bufferedReader ) bufferedReader . close ( ) ; if ( null != inputStreamReader ) inputStreamReader . close ( ) ; } }
read an imputstream reader
