@Override public void reset() { data.wrap(0, 0); length = 0; }
public void wrap(byte[] bytes) { this.bytes.wrap(bytes); this.length = bytes.length; this.hashCode = 0; }
@Override public void wrap(DirectBuffer buffer, int offset, int length) { value.wrap(buffer, offset, length); } }
@Override public void reset() { bytes.wrap(0, 0); length = 0; hashCode = 0; }
@Override public void reset() { bytes.wrap(0, 0); length = 0; hashCode = 0; }
public void wrapBuffer(DirectBuffer buffer) { value.wrap(buffer); }
public void wrap(byte[] bytes) { this.bytes.wrap(bytes); this.length = bytes.length; this.hashCode = 0; }
@Override public void reset() { data.wrap(0, 0); length = 0; }
public void wrapBuffer(DirectBuffer buffer, int offset, int length) { value.wrap(buffer, offset, length); }
@Override public int process(ByteBuffer byteBuffer, int readResult) { if (byteBuffer.capacity() < HEADER_BLOCK_LENGTH) { readResult = (int) OP_RESULT_INSUFFICIENT_BUFFER_CAPACITY; } directBuffer.wrap(byteBuffer); final int startPosition = byteBuffer.position() - readResult; readResult = calculateCorrectReadResult(readResult, startPosition); if (readResult > 0) { byteBuffer.position(startPosition + readResult); byteBuffer.limit(startPosition + readResult); } else if (readResult == 0) { readResult = (int) OP_RESULT_INSUFFICIENT_BUFFER_CAPACITY; } return readResult; }
@Override public int process(ByteBuffer byteBuffer, int readResult) { if (byteBuffer.capacity() < HEADER_BLOCK_LENGTH) { readResult = (int) OP_RESULT_INSUFFICIENT_BUFFER_CAPACITY; } directBuffer.wrap(byteBuffer); final int startPosition = byteBuffer.position() - readResult; readResult = calculateCorrectReadResult(readResult, startPosition); if (readResult > 0) { byteBuffer.position(startPosition + readResult); byteBuffer.limit(startPosition + readResult); } else if (readResult == 0) { readResult = (int) OP_RESULT_INSUFFICIENT_BUFFER_CAPACITY; } return readResult; }
private void allocateMemory(final int capacity) { if (allocatedBuffer != null) { allocatedBuffer.close(); } allocatedBuffer = BufferAllocators.allocateDirect(capacity); buffer.wrap(allocatedBuffer.getRawBuffer()); offset = 0; lastBufferedPosition = lastWrittenPosition; lastBufferedTerm = lastWrittenTerm; }
private void allocateMemory(final int capacity) { if (allocatedBuffer != null) { allocatedBuffer.close(); } allocatedBuffer = BufferAllocators.allocateDirect(capacity); buffer.wrap(allocatedBuffer.getRawBuffer()); offset = 0; lastBufferedPosition = lastWrittenPosition; lastBufferedTerm = lastWrittenTerm; }
public void setValue(WorkflowInstanceRecord value) { final MutableDirectBuffer valueBuffer = new UnsafeBuffer(0, 0); final int encodedLength = value.getLength(); valueBuffer.wrap(new byte[encodedLength]); value.write(valueBuffer, 0); this.value.wrap(valueBuffer, 0, encodedLength); }
public void setValue(WorkflowInstanceRecord value) { final MutableDirectBuffer valueBuffer = new UnsafeBuffer(0, 0); final int encodedLength = value.getLength(); valueBuffer.wrap(new byte[encodedLength]); value.write(valueBuffer, 0); this.value.wrap(valueBuffer, 0, encodedLength); }
/** * Attach a view of the element to a {@link MutableDirectBuffer} for providing direct access. * * @param idx the element to attach. * @param dstBuffer to which the view of the element is attached. * @return the length of the attached element. */ public int wrap(int idx, MutableDirectBuffer dstBuffer) { final int size = size(); boundsCheckIncludingSize(idx, size); final int elementOffset = elementOffset(framedElementLength, idx); final int length = listBuffer.getInt(elementLengthOffset(elementOffset)); dstBuffer.wrap(listBuffer, elementDataOffset(elementOffset), length); return length; }