if (_useFileMappedBuffer && resource.getFile()!=null)
{
File file = resource.getFile();
if (file != null)
buffer = new NIOBuffer(file);
}
else
{
InputStream is = resource.getInputStream();
try
{
Connector connector = HttpConnection.getCurrentConnection().getConnector();
buffer = new NIOBuffer((int) length, ((NIOConnector)connector).getUseDirectBuffers()?NIOBuffer.DIRECT:NIOBuffer.INDIRECT);
}
catch(OutOfMemoryError e)
{
Log.warn(e.toString());
Log.debug(e);
buffer = new NIOBuffer((int) length, NIOBuffer.INDIRECT);
}
buffer.readFrom(is,(int)length);
is.close();
}
content.setBuffer(buffer);