Microsoft Visual J++. Java


- 2


}

 

// =========================================================

// SimpleDBMS

//

// =========================================================

class SimpleDBMS

{

//

RandomAccessFile idx;

 

//

RandomAccessFile dat;

 

//

long idxFilePointer = 0;

 

// -------------------------------------------------------

// SimpleDBMS

// .

// -------------------------------------------------------

public SimpleDBMS(String IndexFile, String DataFile)

{

try

{

//

idx = new RandomAccessFile(IndexFile, "rw");

 

//

dat = new RandomAccessFile(DataFile, "rw");

}

catch(Exception ioe)

{

System.out.println(ioe.toString());

}

}

 

// -------------------------------------------------------

// close

// close.

// -------------------------------------------------------

public void close()

{

try

{

//

idx.close();

 

//

dat.close();

}

catch(Exception ioe)

{

System.out.println(ioe.toString());

}

}

 

// -------------------------------------------------------

// AddRecord

//

// -------------------------------------------------------

public void AddRecord(String name, int account)

{

try

{

//

//

idx.seek(idx.length());

dat.seek(dat.length());

 

// ,

//

idxFilePointer = dat.getFilePointer();

 

//