Hi Cees/others,
Here's a modest proposition for the JDBM (DBM-like) API:
public class JDBM {
public JDBM(String name);
public void put(String key, byte[] content);
public byte[] get(String key);
public boolean remove(String key);
public Enumeration keys();
public Enumeration values();
public void close();
}
As it is, it does not have any options given to the contructor (things
like READ_ONLY, CREATE, NEW, ...). I'm not sure if we really need them
or want to support them.
For readability, I have not specified the IOException but each put(),
get() and remove() could throw an IOException. You'll notice also that
keys() and values() both use a simple Enumeration. I'm not sure if we
want to offer an Iterator which would allow the use of
Iterator.remove(...) during a traversal.
One problem with Enumeration is that it can't throw IOException during a
call to nextElement() or hasMoreElements(). Maybe we should create a
JDBMEnumeration interface to expose potential IOExceptions??
Feedback is welcome. I'm very flexible on all the above.
alex.
PS: I haven't considered implementation details yet, so if you have
ideas, send them along.
--
Alex Boisvert, XJ2EE Project Manager
Exoffice Technologies, Inc.
http://www.exoffice.com
mailto:boisvert@...
|