Class FrameWriterBuffer

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_CAPACITY  
    • Constructor Summary

      Constructors 
      Constructor Description
      FrameWriterBuffer()
      Creates a new WritableBuffer with default capacity.
      FrameWriterBuffer​(int capacity)
      Create a new WritableBuffer with the given capacity.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] array()  
      int arrayOffset()  
      void ensureRemaining​(int requiredRemaining)
      Ensures the the buffer has at least the requiredRemaining space specified.
      boolean hasRemaining()  
      int limit()  
      int position()  
      void position​(int position)  
      void put​(byte b)  
      void put​(byte[] src, int offset, int length)  
      void put​(java.nio.ByteBuffer payload)  
      void put​(ReadableBuffer payload)  
      void putDouble​(double value)  
      void putFloat​(float value)  
      void putInt​(int value)  
      void putLong​(long value)  
      void putShort​(short value)  
      int remaining()  
      int transferTo​(java.nio.ByteBuffer target)
      Copy bytes from this buffer into the target buffer and compacts this buffer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • array

        public byte[] array()
      • arrayOffset

        public int arrayOffset()
      • put

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

        public void put​(java.nio.ByteBuffer payload)
        Specified by:
        put 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.
      • transferTo

        public int transferTo​(java.nio.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.