Interface DERBuffer

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      int capacity()
      Returns this buffer's capacity.
      DERBuffer clear()
      Sets the position to zero and the limit to the capacity.
      byte get()
      Relative get method.
      DERBuffer get​(byte[] dst)
      Relative bulk get method.
      default byte[] getRemainingBytes()
      Returns the bytes remaining in the buffer.
      default boolean hasRemaining()
      Returns whether there are any elements between the current position and the limit.
      int limit()
      Returns this buffer's limit.
      DERBuffer limit​(int newLimit)
      Sets this buffer's limit.
      int position()
      Returns this buffer's position.
      DERBuffer position​(int newPosition)
      Sets this buffer's position.
      default int remaining()
      Returns the number of elements between the current position and the limit.
      DERBuffer slice()
      Creates a new DER buffer whose content is a shared sub-sequence of this buffer's content.
    • Method Detail

      • position

        int position()
        Returns this buffer's position.
        Returns:
        position of this buffer
      • position

        DERBuffer position​(int newPosition)
        Sets this buffer's position.
        Parameters:
        newPosition - The new position value; must be non-negative and no larger than the current limit
        Returns:
        This buffer
        Throws:
        IllegalArgumentException - if the preconditions on newPosition do not hold
      • limit

        int limit()
        Returns this buffer's limit.
        Returns:
        limit of this buffer
      • limit

        DERBuffer limit​(int newLimit)
        Sets this buffer's limit.
        Parameters:
        newLimit - The new limit value; must be non-negative and no larger than this buffer's capacity
        Returns:
        This buffer
        Throws:
        IllegalArgumentException - if the preconditions on newLimit do not hold
      • clear

        DERBuffer clear()
        Sets the position to zero and the limit to the capacity.

        This method does not actually erase the data in the buffer.

        Returns:
        This buffer
      • remaining

        default int remaining()
        Returns the number of elements between the current position and the limit.
        Returns:
        number of elements remaining in this buffer
      • hasRemaining

        default boolean hasRemaining()
        Returns whether there are any elements between the current position and the limit.
        Returns:
        true iff there is at least one element remaining in this buffer
      • capacity

        int capacity()
        Returns this buffer's capacity.
        Returns:
        capacity of this buffer
      • get

        byte get()
        Relative get method. Reads the byte at this buffer's current position and then increments the position.
        Returns:
        byte at the buffer's current position
      • get

        DERBuffer get​(byte[] dst)
        Relative bulk get method.
        Parameters:
        dst - destination array
        Returns:
        This buffer
      • getRemainingBytes

        default byte[] getRemainingBytes()
        Returns the bytes remaining in the buffer. Those bytes between position() and limit().
        Returns:
        remaining bytes
      • slice

        DERBuffer slice()
        Creates a new DER buffer whose content is a shared sub-sequence of this buffer's content.

        The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position and limit will be independent.

        The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer.

        Returns:
        The new byte buffer