public static String convertAsciiInputStreamToString(InputStream inputStream,int inputStreamLength) throws IOException {
  InputStreamReader in=new InputStreamReader(inputStream);
  StringWriter writer=new StringWriter();
  int blockSize=DEFAULT_BUFFER_SIZE;
  char[] buffer=new char[blockSize];
  int left=inputStreamLength;
  while (left > 0) {
    int read=in.read(buffer,0,left > blockSize ? blockSize : left);
    if (read == -1)     break;
    writer.write(buffer,0,read);
    left-=read;
  }
  writer.close();
  return writer.toString();
}

public static String convertAsciiInputStreamToString ( InputStream inputStream , int inputStreamLength ) throws IOException { InputStreamReader in = new InputStreamReader ( inputStream ) ; StringWriter writer = new StringWriter ( ) ; int blockSize = DEFAULT_BUFFER_SIZE ; char [ ] buffer = new char [ blockSize ] ; int left = inputStreamLength ; while ( left > 0 ) { int read = in . read ( buffer , 0 , left > blockSize ? blockSize : left ) ; if ( read == - 1 ) break ; writer . write ( buffer , 0 , read ) ; left -= read ; } writer . close ( ) ; return writer . toString ( ) ; }
converts an ascii input stream to a string
