buffer = new NIOBuffer((int) length, ((NIOConnector)connector).getUseDirectBuffers()?NIOBuffer.DIRECT:NIOBuffer.INDIRECT);
try { 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); }
        protected void fill(Content content) throws IOException        {            Connector connector = HttpConnection.getCurrentConnection().getConnector();            if (connector instanceof NIOConnector)             {                Buffer buffer=null;                Resource resource=content.getResource();                long length=resource.length();                                if (_useFileMappedBuffer)                 {                        File file = resource.getFile();                    if (file != null)                         buffer = new NIOBuffer(file);                }                 else                 {                    FileInputStream fis = new FileInputStream(resource.getFile());                    buffer = new NIOBuffer((int) length, ((NIOConnector)connector).getUseDirectBuffers()?NIOBuffer.DIRECT:NIOBuffer.INDIRECT);                    buffer.readFrom(fis,(int)length);                    fis.close();                }                content.setBuffer(buffer);            }             else             {                super.fill(content);            }                       }