Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
  • Frits Walraven
  • Carey Brown
  • Jj Roberts


Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am trying to read from an inputSource and stored the read characters into a stringbuffer. This is causing the outOfMemory beyond certain sized datasource (data that I am returning in the form of XML from Oracle). I read somewhere that I can buffer the read and thus overcome this problem. However, I am not sure how to implement it codewise.
Here is my code (works great for files upto 0.5MB):
int c;
InputStream in=clobXML.getAsciiStream();
while ((c = != -1) {sb.append((char) c);}
Can someone please help me as to how to modify this code? Thanks
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
  • Report post to moderator
Not sure if this will help, but are you talking about using a BufferedInputStream? If so, construct it like so:
BufferedInputStream buffer = new BufferedInputStream( clobXML.getAsciiStream() );
Then you can read like normal.
moose poop looks like football shaped elk poop. About the size of this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic