I have a lot of info coming down from a server, im using the following method to convert from inputstream to string, but it can take many minutes, we have 52,000 records coming down (about 20 meg of text!).. Is there any way to optimise this method ?
private String readResponseX(InputStream input, int state)
{
StringBuffer sb = new StringBuffer();
try
{
int chars, i = 0;
_("converting response to string");
while ((chars = input.read()) != -1)
{
sb.append((char) chars);
}
_("done.");
input.close();//////
}
catch (Exception e)
{
_("!!!!!!! WARNING !!!!!!!!!! readResponseX() warning error reading input steam!!"+e.getMessage());
}
return sb.toString();
}