Class ByteBuffer

ByteBuffer provides a compact byte array representation for sending, receiving and processing binary data using WebSocket.


Field Summary
Array array
          The array property provides byte storage for the buffer.
Boolean autoExpand
          The autoExpand property enables writing variable length data, and is on by default.
Number capacity
          The capacity property indicates the maximum number of bytes of storage available if the buffer is not automatically expanding.
Number limit
          The limit property indicates the last byte of data available for reading.
ByteOrder order
          The order property indicates the endianness of multibyte integer types in the buffer.
Number position
          The position property indicates the progress through the buffer, and indicates the position within the underlying array that subsequent data will be read from or written to.
 
Constructor Summary
ByteBuffer(bytes)
            Creates a new ByteBuffer instance.
 
Method Summary
<static>  ByteBuffer allocate(capacity)
           Allocates a new ByteBuffer instance.
 ByteBuffer clear()
           Clears the buffer.
 ByteBuffer compact()
           Compacts the buffer by removing leading bytes up to the buffer position, and decrements the limit and position values accordingly.
 ByteBuffer duplicate()
           Duplicates the buffer by reusing the underlying byte array but with independent position, limit and capacity.
 ByteBuffer expand(expectedRemaining)
           Expands the buffer to support the expected number of remaining bytes after the current position.
 ByteBuffer expandAt(i, expectedRemaining)
           Expands the buffer to support the expected number of remaining bytes at the specified index.
 ByteBuffer fill(size)
           Fills the buffer with a repeated number of zeros.
 ByteBuffer fillWith(b, size)
           Fills the buffer with a specific number of repeated bytes.
 ByteBuffer flip()
           Flips the buffer.
 Number get()
           Returns a single-byte number from the buffer at the current position.
 ArrayBuffer getArrayBuffer(size)
           Returns a ArrayBuffer from the buffer at the current position.
 Number getAt(index)
           Returns a single-byte number from the buffer at the specified index.
 Blob getBlob(size)
           Returns a Blob from the buffer at the current position.
 Blob getBlobAt(index, size)
           Returns a Blob from the buffer at the specified index.
 Array getBytes(index, size)
           Returns a n-byte number from the buffer at the specified index.
 Array getBytes(size)
           Returns a n-byte number from the buffer at the current position.
 String getHexDump()
           Returns a hex dump of this buffer.
 Number getInt()
           Returns a four-byte number from the buffer at the current position.
 Number getIntAt(index)
           Returns a four-byte number from the buffer at the specified index.
 Number getMediumInt()
           Returns a three-byte number from the buffer at the current position.
 Number getMediumIntAt(i)
           Returns a three-byte number from the buffer at the specified index.
 String getPrefixedString(fieldSize, cs)
           Returns a length-prefixed string from the buffer at the current position.
 Number getShort()
           Returns a two-byte number from the buffer at the current position.
 Number getShortAt(index)
           Returns a two-byte number from the buffer at the specified index.
 String getString(cs)
           Returns a string from the buffer at the current position.
 Number getUnsigned()
           Returns an unsigned single-byte number from the buffer at the current position.
  getUnsignedAt(index)
           Returns an unsigned single-byte number from the buffer at the specified index.
 Number getUnsignedInt()
           Returns an unsigned four-byte number from the buffer at the current position.
 Number getUnsignedIntAt(index)
           Returns an unsigned four-byte number from the buffer at the specified position.
 Number getUnsignedMediumInt()
           Returns an unsigned three-byte number from the buffer at the current position.
 Number getUnsignedShort()
           Returns an unsigned two-byte number from the buffer at the current position.
  getUnsignedShortAt()
           Returns an unsigned two-byte number from the buffer at the specified index.
 Boolean hasRemaining()
           Returns true if this buffer has remaining bytes, false otherwise.
 Number indexOf(b)
           Returns the index of the specified byte in the buffer.
 ByteBuffer mark()
           Marks a position in the buffer.
 ByteBuffer put(v)
           Puts a single byte number into the buffer at the current position.
 ByteBuffer putAt(index, v)
           Puts a single byte number into the buffer at the specified index.
 ByteBuffer putBuffer(v)
           Puts a buffer into the buffer at the current position.
 ByteBuffer putBufferAt(index, v)
           Puts a buffer into the buffer at the specified index.
 ByteBuffer putByteArray(v)
           Puts a ByteArray into the buffer at the current position.
 ByteBuffer putBytes(v)
           Puts a single-byte array into the buffer at the current position.
 ByteBuffer putBytesAt(index, v)
           Puts a byte array into the buffer at the specified index.
 ByteBuffer putInt(v)
           Puts a four-byte number into the buffer at the current position.
 ByteBuffer putIntAt(index, v)
           Puts a four-byte number into the buffer at the specified index.
 ByteBuffer putMediumInt(v)
           Puts a three-byte number into the buffer at the current position.
 ByteBuffer putMediumIntAt(index, v)
           Puts a three-byte number into the buffer at the specified index.
 ByteBuffer putPrefixedString(fieldSize, v, cs)
           Puts a string into the buffer at the specified index, using the character set to encode the string as bytes.
 ByteBuffer putShort(v)
           Puts a two-byte short into the buffer at the current position.
 ByteBuffer putShortAt(index, v)
           Puts a two-byte short into the buffer at the specified index.
 ByteBuffer putString(v, cs)
           Puts a string into the buffer at the current position, using the character set to encode the string as bytes.
 ByteBuffer putUnsigned(v)
           Puts an unsigned single-byte number into the buffer at the current position.
 ByteBuffer putUnsignedAt(index, v)
           Puts an unsigned single byte into the buffer at the specified position.
 ByteBuffer putUnsignedInt(i)
           Puts an unsigned four-byte number into the buffer at the current position.
 ByteBuffer putUnsignedIntAt(index, v)
           Puts an unsigned four-byte number into the buffer at the specified index.
 ByteBuffer putUnsignedShort(v)
           Puts a two-byte unsigned short into the buffer at the current position.
 ByteBuffer putUnsignedShort(v)
           Puts a two-byte unsigned short into the buffer at the current position.
 Number remaining()
           Returns the number of bytes remaining from the current position to the limit.
 ByteBuffer reset()
           Resets the buffer position using the mark.
 ByteBuffer rewind()
           Rewinds the buffer.
 ByteBuffer skip(size)
           Skips the specified number of bytes from the current position.
 ByteBuffer slice()
           Returns a sliced buffer, setting the position to zero, and decrementing the limit accordingly.
 String toString()
           Returns the string representation of this buffer.
<static>  ByteBuffer wrap(bytes)
           Wraps a byte array as a new ByteBuffer instance.
 
Field Detail

array

Array array

autoExpand

Boolean autoExpand

capacity

Number capacity

limit

Number limit

order

ByteOrder order

position

Number position

Constructor Detail

ByteBuffer

ByteBuffer(bytes)

Method Detail

allocate

<static> ByteBuffer allocate(capacity)

clear

ByteBuffer clear()

compact

ByteBuffer compact()

duplicate

ByteBuffer duplicate()

expand

ByteBuffer expand(expectedRemaining)

expandAt

ByteBuffer expandAt(i, expectedRemaining)

fill

ByteBuffer fill(size)

fillWith

ByteBuffer fillWith(b, size)

flip

ByteBuffer flip()

get

Number get()

getArrayBuffer

ArrayBuffer getArrayBuffer(size)

getAt

Number getAt(index)

getBlob

Blob getBlob(size)

getBlobAt

Blob getBlobAt(index, size)

getBytes

Array getBytes(index, size)

getBytes

Array getBytes(size)

getHexDump

String getHexDump()

getInt

Number getInt()

getIntAt

Number getIntAt(index)

getMediumInt

Number getMediumInt()

getMediumIntAt

Number getMediumIntAt(i)

getPrefixedString

String getPrefixedString(fieldSize, cs)

getShort

Number getShort()

getShortAt

Number getShortAt(index)

getString

String getString(cs)

getUnsigned

Number getUnsigned()

getUnsignedAt

 getUnsignedAt(index)

getUnsignedInt

Number getUnsignedInt()

getUnsignedIntAt

Number getUnsignedIntAt(index)

getUnsignedMediumInt

Number getUnsignedMediumInt()

getUnsignedShort

Number getUnsignedShort()

getUnsignedShortAt

 getUnsignedShortAt()

hasRemaining

Boolean hasRemaining()

indexOf

Number indexOf(b)

mark

ByteBuffer mark()

put

ByteBuffer put(v)

putAt

ByteBuffer putAt(index, v)

putBuffer

ByteBuffer putBuffer(v)

putBufferAt

ByteBuffer putBufferAt(index, v)

putByteArray

ByteBuffer putByteArray(v)

putBytes

ByteBuffer putBytes(v)

putBytesAt

ByteBuffer putBytesAt(index, v)

putInt

ByteBuffer putInt(v)

putIntAt

ByteBuffer putIntAt(index, v)

putMediumInt

ByteBuffer putMediumInt(v)

putMediumIntAt

ByteBuffer putMediumIntAt(index, v)

putPrefixedString

ByteBuffer putPrefixedString(fieldSize, v, cs)

putShort

ByteBuffer putShort(v)

putShortAt

ByteBuffer putShortAt(index, v)

putString

ByteBuffer putString(v, cs)

putUnsigned

ByteBuffer putUnsigned(v)

putUnsignedAt

ByteBuffer putUnsignedAt(index, v)

putUnsignedInt

ByteBuffer putUnsignedInt(i)

putUnsignedIntAt

ByteBuffer putUnsignedIntAt(index, v)

putUnsignedShort

ByteBuffer putUnsignedShort(v)

putUnsignedShort

ByteBuffer putUnsignedShort(v)

remaining

Number remaining()

reset

ByteBuffer reset()

rewind

ByteBuffer rewind()

skip

ByteBuffer skip(size)

slice

ByteBuffer slice()

toString

String toString()

wrap

<static> ByteBuffer wrap(bytes)

Documentation generated by JsDoc Toolkit 1.3.3 on Thu Sep 25 2014 15:48:02 GMT-0700 (PDT)