thanks man, knew there was something, I did try that but I must have got it 
wrong cause my json got messed up, but will try it again, cheers. 1024 is 
ok for byte[] size?

On Friday, April 6, 2018 at 7:57:20 PM UTC+8, Steve Hannah wrote:
>
> Use Util.readToString(input) instead,
> or use InputStream.read(byte[]) instead of InputStream.read() so that you 
> read a whole buffer at a time rather than one byte at a time.
>
> Steve
>
> On Fri, Apr 6, 2018 at 4:31 AM, Gareth Murfin <gareth...@gmail.com 
> <javascript:>> wrote:
>
>> 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();
>>     }   
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "CodenameOne Discussions" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to codenameone-discussions+unsubscr...@googlegroups.com 
>> <javascript:>.
>> Visit this group at 
>> https://groups.google.com/group/codenameone-discussions.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/codenameone-discussions/b01596da-b9ef-4ec5-8540-80d175a706e1%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/codenameone-discussions/b01596da-b9ef-4ec5-8540-80d175a706e1%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Steve Hannah
> Software Developer
> Codename One
> http://www.codenameone.com
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/4d6b688c-ba98-4429-8f89-b2516f0cb551%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to