Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • IBuffer

Implemented by

Index

Methods

capacity

  • capacity(): number

clear

  • Invoke this method before using a sequence of channel-read or put operations to fill this buffer. For example: buf.clear(); // Prepare buffer for reading in.read(buf); // Read data This method does not actually erase the data in the buffer, but it is named as if it did because it will most often be used in situations in which that might as well be the case.

    since

    0.0.1

    Returns IBuffer

    This buffer

flip

  • Flips this buffer. The limit is set to the current position and then the position is set to zero. If the mark is defined then it is discarded. After a sequence of channel-read or put operations, invoke this method to prepare for a sequence of channel-write or relative get operations. For example: buf.put(magic); // Prepend header in.read(buf); // Read data into rest of buffer buf.flip(); // Flip buffer out.write(buf); // Write header + data to channel This method is often used in conjunction with the compact method when transferring data from one place to another.

    since

    0.0.1

    Returns IBuffer

    This buffer

hasRemaining

  • hasRemaining(): boolean
  • Tells whether there are any elements between the current position and the limit.

    since

    0.0.1

    Returns boolean

    true if, and only if, there is at least one element remaining in this buffer

isReadOnly

  • isReadOnly(): boolean

limit

  • limit(): number
  • limit(newLimit: number): IBuffer
  • Returns this buffer's limit.

    since

    0.0.1

    Returns number

    The limit of this buffer

  • Sets this buffer's limit. If the position is larger than the new limit then it is set to the new limit. If the mark is defined and larger than the new limit then it is discarded.

    throws

    IllegalArgumentException - If the preconditions on newLimit do not hold

    since

    0.0.1

    Parameters

    • newLimit: number

      The new limit value; must be non-negative and no larger than this buffer's capacity

    Returns IBuffer

    This buffer

mark

position

  • position(): number
  • position(newPosition: number): IBuffer
  • Returns this buffer's position.

    Returns number

    The position of this buffer

  • Sets this buffer's position. If the mark is defined and larger than the new position then it is discarded.

    throws

    IllegalArgumentException - If the preconditions on newPosition do not hold

    Parameters

    • newPosition: number

      The new position value; must be non-negative and no larger than the current limit

    Returns IBuffer

    This buffer

remaining

  • remaining(): number

reset

  • Resets this buffer's position to the previously-marked position. Invoking this method neither changes nor discards the mark's value.

    throws

    InvalidMarkException - If the mark has not been set

    Returns IBuffer

    This buffer

rewind

  • Rewinds this buffer. The position is set to zero and the mark is discarded. Invoke this method before a sequence of channel-write or get operations, assuming that the limit has already been set appropriately. For example: out.write(buf); // Write remaining data buf.rewind(); // Rewind buffer buf.get(array); // Copy data into array

    Returns IBuffer

    This buffer

Generated using TypeDoc