I am using SAP KM Apis. however i am facing some memory issues while using them.
I am using getContent() api on a resource. and then getInputStream on the Icontent object. I am using a ByteArrayOutputStream for writing the data. here is the code snippet:
byte buf= new byte;
InputStream inputStream = content.getInputStream();
ByteArrayOutputStream os = new ByteArrayOutputStream(1024)
while ((count = inputStream.read(buf)) != -1)
os.write(buf, 0, count);
THis code consuimes a lot of memory . we need to optimize this. we also tried removing BYteArrayOutputSteam and directly read the bytes in chunk :
n = inputStream.read(buf, 0,(int)content.getContentLength());
while (n != -1);
however this approach has not helped us.
please suggest an approach where memory consumption is less and the entire content is fed.