Why not add this code to a RAMDirectory constructor like:

        public RAMDirectory(Directory d) throws IOException {
                this();
                final String[] ar = d.list();
                for (int i = 0; i < ar.length; i++) {
                        // make place on ram disk
                        OutputStream os = createFile(ar[i]);
                        // read current file
                        InputStream is = d.openFile(ar[i]);
                        // and copy to ram disk
                        int len = (int) is.length();
                        byte[] buf = new byte[len];
                        is.readBytes(buf, 0, len);
                        os.writeBytes(buf, len);
                        // graceful cleanup
                        is.close();
                        os.close();
                }
        }

--
Eric D. Isakson        SAS Institute Inc.
Application Developer  SAS Campus Drive
XML Technologies       Cary, NC 27513
(919) 531-3639         http://www.sas.com


--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@;jakarta.apache.org>

Reply via email to