class MessageFile implements Closeable {

    public void checkpoint(boolean force) throws IOException {
        synchronized (channel) {
            // force all writes to disk before updating checkpoint length so we know all data up to length is good
            channel.force(true);
            if (length != lastCheckpointLength) {
                fileHeader.putInt(8, length);
                if (bucketIndex >= 0) putBucketDataInFileHeader();
                fileHeader.position(0);
                channel.position(0).write(fileHeader);
                lastCheckpointLength = length;
                if (force) channel.force(true);
            }
        }
    }

    @SuppressWarnings("StatementWithEmptyBody") public  MessageFile(File file, long firstMessageId);
    @SuppressWarnings("StatementWithEmptyBody") public  MessageFile(File file, long firstMessageId, int maxFileSize);

}