class PersistentMessageBuffer implements MessageBuffer {

    @Override
    public synchronized MessageCursor cursor(long messageId) throws IOException {
        int i = findFileIndex(messageId);
        if (i < 0) return new EmptyCursor();
        MessageFile mf = getMessageFileForCursor(i);
        long first = mf.getFirstMessageId();
        if (messageId < first) messageId = first;
        return new Cursor(i, mf, mf.cursor(messageId));
    }

    public  PersistentMessageBuffer(File dir);

}