Paul Reavis wrote:
> 
> Urban Widmark wrote:
> >
> >  ... but that would perhaps not be
> > low enough for you so how about:
> >   int fd = open("/dev/hda", O_RDONLY);
> >
> > and then:
> >   lseek()
> >   read()
> 
> Oh ho! That's the best idea so far! Why don't we just skip all this JNI
> nonsense and just open /dev/hda up as a java.io.RandomAccessFile?
> 
> I've just _got_ to try this... though probably on a ramdisk first :-)

Or a floppy... check out these apples:

- - - - - - - - - - - - - - - - - - - - - - - - - >8 - - - - - - - - - 
import java.io.*;

public class DirectAccess {

    public static void main(String[] argv) {
        try {
            RandomAccessFile filet = new RandomAccessFile("/dev/fd0",
"rw");   
            filet.writeChars("Look ma, no filesystem!\n");
            filet.close();
            }
       catch (IOException oopsie) {
            oopsie.printStackTrace(System.err);
            System.exit(1);
            }

       }

    }
- - - - - - - - - - - - - - - - - - - - - - - - - >8 - - - - - - - - - 

slackguy:/home/paul# java DirectAccess     
slackguy:/home/paul# dd if=/dev/fd0 bs=1 count=50
Look ma, no filesystem!
50+0 records in
50+0 records out

Though platform-specific, this would likely work on most unix platforms
(with different /dev/???, of course) and could be used with fixed-size
files even on less noble platforms - you could make a partition, build a
single file in it that takes up all space, and don't let it shrink and
you shouldn't have fragmentation problems.

And now we're all set to build java-based swap partitions, highly
tweaked data storage and retrieval, etc. It's not to be scoffed at - I
used RandomAccessFile and a simple binary-search mechanism on sorted
data to deliver a GIS-like map item search mechanism below 1 ms. search
time. Totally blew away the databases etc. I was trying at the time, and
is faster than the general search routines AutoCAD and ESRI provide.

-- 

Paul Reavis                                      [EMAIL PROTECTED]
Design Lead
Partner Software, Inc.                        http://www.partnersoft.com

Reply via email to