try
{
Connector connector = HttpConnection.getCurrentConnection().getConnector();
buffer = ((NIOConnector)connector).getUseDirectBuffers()?
(NIOBuffer)new DirectNIOBuffer((int)length):
(NIOBuffer)new IndirectNIOBuffer((int)length);
}
catch(OutOfMemoryError e)
{
Log.warn(e.toString());
Log.debug(e);
buffer = new IndirectNIOBuffer((int) length);
}
buffer.readFrom(is,(int)length);
is.close();
}
content.setBuffer(buffer);