Simple Rows Based File


What is Simple Rows Based File?

Simple Rows Based File is like Java ISAM file. You can insert your Java objects into that file and retieve those objects later.

Why do I write Simple Rows Based File?

Sometime, I need to store many data at local file and retieve those data later. So I wrote Simple Rows Based File.

How to use Simple Rows Based File?

First you need to define your Java class like this:

public class MyData {
    @RowFld(name = "id", colSeq = 1, PkSeq = 1)
    private int ID;
    @RowFld(name = "name", colSeq = 2)
    private String NAME;

I use annotation to define which field you want to store into file and used as primary key.
After define your data class, you should initialize your data file and insert your objects like this:
File file = ...
RowBasedFile rowBasedFile = RowBasedFile.initialize(file);
// store your java object
MyData mydata = ...

If you want to retrieve the data...
File file = ...
RowBasedFile rowBasedFile = RowBasedFile.load(file);
// retrieve your data
int idx = ... ;
MyData mydata = rowBasedFile.selectByPKey(MyData.class, idx);


Apache License V2.0