net.aerith.misao.io
Class XmlDBHolderCache
java.lang.Object
|
+--net.aerith.misao.io.XmlDBHolderCache
- public class XmlDBHolderCache
- extends java.lang.Object
The XmlDBHolderCache
represents a disk cache to read
and write XML files in the database.
Field Summary |
protected static boolean |
enable_cache
True if the disk cache is enabled. |
protected static CacheEntry[] |
entries
The entries. |
protected static int |
file_count
The number of XML files in cache. |
protected static int |
update_limit
The limit to update without saving to a file. |
Method Summary |
static void |
enable(boolean flag)
Enables/disables the disk cache. |
static void |
flush()
Saves the XML documents into files. |
static XmlDBHolder |
read(java.io.File file,
XmlDBHolder holder_class)
Reads the XML document. |
static void |
write(java.io.File file,
XmlDBHolder holder)
Writes the XML document. |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
file_count
protected static final int file_count
- The number of XML files in cache.
update_limit
protected static int update_limit
- The limit to update without saving to a file.
entries
protected static CacheEntry[] entries
- The entries.
enable_cache
protected static boolean enable_cache
- True if the disk cache is enabled.
XmlDBHolderCache
public XmlDBHolderCache()
enable
public static void enable(boolean flag)
throws java.io.IOException
- Enables/disables the disk cache.
- Parameters:
flag
- true when to enable the disk cache.- Throws:
- java.io.IOException - if I/O error occurs.
read
public static XmlDBHolder read(java.io.File file,
XmlDBHolder holder_class)
throws java.io.IOException
- Reads the XML document.
- Parameters:
file
- the file.holder_class
- the holder class object of the XML records.- Returns:
- the holder.
- Throws:
- java.io.IOException - if I/O error occurs.
write
public static void write(java.io.File file,
XmlDBHolder holder)
throws java.io.IOException
- Writes the XML document.
- Parameters:
file
- the file.holder
- the holder.- Throws:
- java.io.IOException - if I/O error occurs.
flush
public static void flush()
throws java.io.IOException
- Saves the XML documents into files.
- Throws:
- java.io.IOException - if I/O error occurs.