Inspired by the talk on slashdot recently about google using solid state ("ram") disks I wanted to play around w/ Lucene runnning purely out of memory.
Could anyone glance at this and verify that this code is correct. Goal is to convert an existing, on-disk, index to a RAMDirectory, which presumably is purely in memory. If the code is correct I'd suggest someone w/ CVS powers adding it to the source base - maybe a static method in RAMDirectory itself. public static RAMDirectory convert( String path) throws IOException { final RAMDirectory ram = new RAMDirectory(); final Directory d = FSDirectory.getDirectory( path, false); final String[] ar = d.list(); for ( int i = 0; i< ar.length; i++) { // make place on ram disk OutputStream os = ram.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(); } return ram; } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>