// do not write if not dirty
if (!dirty) {
return;
}
OutputStream out = new IndexOutputStream(dir.createOutput(name + ".new"));
try {
DataOutputStream dataOut = new DataOutputStream(out);
dataOut.writeInt(counter);
dataOut.writeInt(indexes.size());
for (int i = 0; i < indexes.size(); i++) {
dataOut.writeUTF(getName(i));
}
} finally {
out.close();
}
// delete old
if (dir.fileExists(name)) {
dir.deleteFile(name);
}