|
|
@ -178,6 +178,7 @@ public final class Records {
|
|
|
|
* write buffer to end of file
|
|
|
|
* write buffer to end of file
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected final synchronized void flushBuffer() {
|
|
|
|
protected final synchronized void flushBuffer() {
|
|
|
|
|
|
|
|
if (raf == null) return;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
raf.seek(raf.length());
|
|
|
|
raf.seek(raf.length());
|
|
|
|
raf.write(this.buffer, 0, this.recordsize * this.buffercount);
|
|
|
|
raf.write(this.buffer, 0, this.recordsize * this.buffercount);
|
|
|
@ -188,10 +189,9 @@ public final class Records {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public final synchronized void close() {
|
|
|
|
public final synchronized void close() {
|
|
|
|
flushBuffer();
|
|
|
|
// close the file
|
|
|
|
|
|
|
|
|
|
|
|
// then close the file
|
|
|
|
|
|
|
|
if (raf != null) try {
|
|
|
|
if (raf != null) try {
|
|
|
|
|
|
|
|
flushBuffer();
|
|
|
|
raf.close();
|
|
|
|
raf.close();
|
|
|
|
} catch (final IOException e) {
|
|
|
|
} catch (final IOException e) {
|
|
|
|
Log.logException(e);
|
|
|
|
Log.logException(e);
|
|
|
|