lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject RE: Converting a Directory to a RAMDirectory
Date Thu, 17 Oct 2002 18:59:59 GMT
Yes, I forgot to list that option.

Btw. this all sounds very familiar.  I thought somebody (from France?)
has already contributed this months ago.

Otis


--- Eric Isakson <Eric.Isakson@sas.com> wrote:
> 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>
> 


__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

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


Mime
View raw message