Is there a ready-to-use solution for working with big arrays in Java so that only a part of the array is in memory and everything else is stored on disk? Thanks.
Stephen Huey
Ranch Hand
Joined: Jul 15, 2003
Posts: 618
posted
0
I don't know of anything like that in the API...
Rick O'Shay
Ranch Hand
Joined: Sep 19, 2004
Posts: 531
posted
0
NIO has classes that do just that. It's a fundamental requirement for a serious server environment and was added in Java 1.4. NIO used to be done using native method interfaces and that's no longer required.
Originally posted by Rick O'Shay: NIO has classes that do just that. It's a fundamental requirement for a serious server environment and was added in Java 1.4. NIO used to be done using native method interfaces and that's no longer required.
Thanks Rick. So do you suggest creating FileChannel and using position() and read()/write() methods to do the job? Wouldn't that be too expensive and slow? I thought of much more sophisticated approach.
Rick O'Shay
Ranch Hand
Joined: Sep 19, 2004
Posts: 531
posted
0
Impossible to say without analyzing your requirements. The disk is slower but usually plenty fast depending on the application and the bits are dirt cheap. Actually, I think dirts a little more