Class FrameWriterBuffer

java.lang.Object
org.apache.qpid.proton.engine.impl.FrameWriterBuffer
All Implemented Interfaces:
WritableBuffer

public class FrameWriterBuffer extends Object implements WritableBuffer
  • Field Details

  • Constructor Details

    • FrameWriterBuffer

      public FrameWriterBuffer()
      Creates a new WritableBuffer with default capacity.
    • FrameWriterBuffer

      public FrameWriterBuffer(int capacity)
      Create a new WritableBuffer with the given capacity.
      Parameters:
      capacity - the inital capacity to allocate for this buffer.
  • Method Details

    • array

      public byte[] array()
    • arrayOffset

      public int arrayOffset()
    • put

      public void put(byte b)
      Specified by:
      put in interface WritableBuffer
    • putShort

      public void putShort(short value)
      Specified by:
      putShort in interface WritableBuffer
    • putInt

      public void putInt(int value)
      Specified by:
      putInt in interface WritableBuffer
    • putLong

      public void putLong(long value)
      Specified by:
      putLong in interface WritableBuffer
    • putFloat

      public void putFloat(float value)
      Specified by:
      putFloat in interface WritableBuffer
    • putDouble

      public void putDouble(double value)
      Specified by:
      putDouble in interface WritableBuffer
    • put

      public void put(byte[] src, int offset, int length)
      Specified by:
      put in interface WritableBuffer
    • put

      public void put(ByteBuffer payload)
      Specified by:
      put in interface WritableBuffer
    • put

      public void put(ReadableBuffer payload)
      Specified by:
      put in interface WritableBuffer
    • hasRemaining

      public boolean hasRemaining()
      Specified by:
      hasRemaining in interface WritableBuffer
    • remaining

      public int remaining()
      Specified by:
      remaining in interface WritableBuffer
    • ensureRemaining

      public void ensureRemaining(int requiredRemaining)
      Ensures the the buffer has at least the requiredRemaining space specified.

      The internal buffer will be doubled if the requested capacity is less than that amount or the buffer will be expanded to the full new requiredRemaining value.

      Specified by:
      ensureRemaining in interface WritableBuffer
      Parameters:
      requiredRemaining - the minimum remaining bytes needed to meet the next write operation.
    • position

      public int position()
      Specified by:
      position in interface WritableBuffer
    • position

      public void position(int position)
      Specified by:
      position in interface WritableBuffer
    • limit

      public int limit()
      Specified by:
      limit in interface WritableBuffer
    • transferTo

      public int transferTo(ByteBuffer target)
      Copy bytes from this buffer into the target buffer and compacts this buffer.

      Copy either all bytes written into this buffer (start to current position) or as many as will fit if the target capacity is less that the bytes written. Bytes not read from this buffer are moved to the front of the buffer and the position is reset to the end of the copied region.

      Parameters:
      target - The array to move bytes to from those written into this buffer.
      Returns:
      the number of bytes transfered to the target buffer.