0

I am getting JSON response and storing in inputstream. When converting it into string it is showing ... after certain string length if size is greater.

I converted the inputstream to ByteArrayOutputStream to check out size. Following is the code

HttpEntity entity = response.getEntity();
inputStream = entity.getContent();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int reads = inputStream.read();
while (reads != -1) {
baos.write(reads);
reads = inputStream.read();
}
int length = baos.toByteArray().length;

The length is coming out to be 22653 and baos is having {"id":"772","co...

Can you please suggest how to handle this scenerio.

Harsh
  • 599
  • 3
  • 20
  • 1
    Where do you see "..."? In a debugger? Could it be that the debugger decides to not show long strings and abbreviates them? – Joni Aug 02 '13 at 06:32
  • 1
    This is probably a feature of the console, widget or whatever you're using to display the string. It has 22653 characters, but is only displaying the first ones to avoid wasting space. Your code is fine. – JB Nizet Aug 02 '13 at 06:32
  • 1
    It's the debugger, if you actually copy that log line and paste in a text editor, you'll see the complete content. – Kai Aug 02 '13 at 06:41
  • Thanks Joni and Kai..its a debugger feature. – Harsh Aug 05 '13 at 05:41

0 Answers0