"0xC0C0BABE" 有什么特殊的含义吗?
private static final int MAGIC = 0xC0C0BABE;
File f = new File(dbname);
if (f.exists() && f.canRead() && f.canWrite())
{
db = new RandomAccessFile(f, "rw");
headerLen = db.readInt();
int nFields= db.readInt();
recordCount = db.readInt();
description = new FieldInfo[nFields];
。。。。。。。。。。。。。。。
if (db.readInt() != MAGIC)
{
throw new IOException("Data: corrupted database file. " +
"Magic not found in file " + dbname);
}
大约。我也能猜出来,但是希望又一个明确的答案。谢谢