3 import java
.lang
.reflect
.Array
;
6 TreeSet for runtimedatabase with entry hash used in compareto
7 fix commandline interface.
10 public class RuntimeDatabase
{
11 protected static RuntimeDatabase instance
=null;
12 protected TreeMap entries
;
13 protected int entrycount
;
14 public static final int headersize
= 8;
16 protected RuntimeDatabase() {
17 entries
=new TreeMap();
20 public static RuntimeDatabase
getInstance() {
22 instance
=new RuntimeDatabase();
26 public RundbEntry
getEntry(FileEntry file
) {
27 Integer key
= new Integer(file
.getHash());
28 if(!entries
.containsKey(key
)) {
29 RundbEntry e
= new RundbEntry(file
);
34 return (RundbEntry
)entries
.get(key
);
37 protected void calcOffsets() {
38 Collection values
= entries
.values();
40 int offset
=headersize
;
43 Entry e
= (Entry
) i
.next();
45 offset
+=RundbEntry
.entrySize();
47 entrycount
=values
.size();
50 public int isDirty() {
54 protected void writeHeader(DataOutputStream w
) throws IOException
{
59 w
.writeInt(entrycount
);
62 public void prepareWrite() {
63 System
.out
.println("Calculating Runtime Database Offsets..");
67 public void writeDatabase(File f
) throws IOException
{
70 DataOutputStream w
= new DataOutputStream(new FileOutputStream(f
));
71 System
.out
.println("Writing runtime database..");
73 i
=entries
.values().iterator();
75 Entry e
= (Entry
) i
.next();