orgecc


Using RandomAccessFile to access data which doesn’t come from a local file.

Posted in java by elifarley on the February 27th, 2007

Some libraries and applications rely on a RandomAccessFile instance to process its IO tasks, and thus are usually limited to access data from a local file.
If an application needs to access data from another source (from an SFTP file, an HTTP file, CIFS-accessible file, a file inside a zip, tar, gzip or bzip2 archive, etc), it has to use another algorithm - the process isn’t transparent.

Such application could be benefited by an adapter class providing a “RandomAccessFile” view of arbitrary data sources, allowing it to transparently access data from different sources.

Example: a database server using a RandomAccessFile instance to access its data from a local file would automatically be able to access it from a gzip-compressed file.

RACRandomAccessFile is such an adapter class; by leveraging Commons-VFS and the file systems it provides, it allows you to use any RandomAccessContent instance as if it were a RandomAccessFile instance.

And it’s easy to use. See the usage example below:

WordPress database error: [Table './orgecc_wordpress/wp_comments' is marked as crashed and should be repaired]
SELECT * FROM wp_comments WHERE comment_post_ID = '4' AND comment_approved = '1' ORDER BY comment_date

Leave a Reply


WP-Highlight