protected boolean readMessage(final int fragmentLength) { final int capacity = buffer.capacity() - HEADER_LENGTH; int remainingBytes = fragmentLength; while (remainingBytes > 0) { final int limit = Math.min(remainingBytes, capacity); readIntoBuffer(ioBuffer, HEADER_LENGTH, limit); remainingBytes -= limit; } return true; }
protected boolean readHeader() { return readIntoBuffer(ioBuffer, 0, HEADER_LENGTH); }
protected boolean readHeader() { return readIntoBuffer(ioBuffer, 0, HEADER_LENGTH); }
public void wrap(LogStream logStream) { this.logStream = logStream; this.blockIndex = logStream.getLogBlockIndex(); this.logStorage = logStream.getLogStorage(); clear(); }
protected boolean next() { currentAddress = nextReadAddress; if (!readHeader()) { return false; } final int fragmentLength = getFragmentLength(buffer, 0); return readMessage(fragmentLength - HEADER_LENGTH); }
public static long getAddressForPosition(LogStream stream, long position) { final LogEntryAddressSupplier logEntryAddressSupplier = LogEntryAddressSupplier.getInstance(); logEntryAddressSupplier.wrap(stream); return logEntryAddressSupplier.getAddress(position); }
protected boolean next() { currentAddress = nextReadAddress; if (!readHeader()) { return false; } final int fragmentLength = getFragmentLength(buffer, 0); return readMessage(fragmentLength - HEADER_LENGTH); }
public long getAddress(final long position) { clear(); if (!findStartAddress(position)) { return nextReadAddress; } return findAddress(position); }
public long getAddress(final long position) { clear(); if (!findStartAddress(position)) { return nextReadAddress; } return findAddress(position); }
public void wrap(LogStream logStream) { this.logStream = logStream; this.blockIndex = logStream.getLogBlockIndex(); this.logStorage = logStream.getLogStorage(); clear(); }
public static long getAddressForPosition(LogStream stream, long position) { final LogEntryAddressSupplier logEntryAddressSupplier = LogEntryAddressSupplier.getInstance(); logEntryAddressSupplier.wrap(stream); return logEntryAddressSupplier.getAddress(position); }
protected boolean readMessage(final int fragmentLength) { final int capacity = buffer.capacity() - HEADER_LENGTH; int remainingBytes = fragmentLength; while (remainingBytes > 0) { final int limit = Math.min(remainingBytes, capacity); readIntoBuffer(ioBuffer, HEADER_LENGTH, limit); remainingBytes -= limit; } return true; }