Package | com.kaazing.gateway.client.html5 |
Class | public class ByteBuffer |
Property | Defined by | ||
---|---|---|---|
array : Array
The array property provides byte storage for the buffer.
| ByteBuffer | ||
autoExpand : Boolean = true
The autoExpand property enables writing variable length data,
and is on by default.
| ByteBuffer | ||
capacity : int = 0
The capacity property indicates the maximum number of bytes
of storage available if the buffer is not automatically expanding.
| ByteBuffer | ||
limit : int = 0
The limit property indicates the last byte of data available for
reading.
| ByteBuffer | ||
order : ByteOrder
The order property indicates the endianness of multibyte integer types in
the buffer.
| ByteBuffer | ||
position : int = 0
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.
| ByteBuffer |
Method | Defined by | ||
---|---|---|---|
ByteBuffer(bytes:* = null)
Creates a new ByteBuffer instance.
| ByteBuffer | ||
allocate(capacity:int):ByteBuffer
[static]
Allocates a new ByteBuffer instance.
| ByteBuffer | ||
Clears the buffer.
| ByteBuffer | ||
Compacts the buffer by removing leading bytes up
to the buffer position, and decrements the limit
and position values accordingly.
| ByteBuffer | ||
Duplicates the buffer by reusing the underlying byte
array but with independent position, limit and capacity.
| ByteBuffer | ||
expand(expectedRemaining:int):ByteBuffer
Expands the buffer to support the expected number of remaining bytes
after the current position.
| ByteBuffer | ||
expandAt(i:int, expectedRemaining:int):ByteBuffer
Expands the buffer to support the expected number of remaining bytes
at the specified index.
| ByteBuffer | ||
fill(size:int):ByteBuffer
Fills the buffer with a repeated number of zeros.
| ByteBuffer | ||
fillWith(b:int, size:int):ByteBuffer
Fills the buffer with a specific number of repeated bytes.
| ByteBuffer | ||
Flips the buffer.
| ByteBuffer | ||
get():int
Returns a single-byte number from the buffer at the current position.
| ByteBuffer | ||
getAt(index:int):int
Returns a single-byte number from the buffer at the specified index.
| ByteBuffer | ||
getByteArray(length:int):ByteArray
Returns bytes in an ByteArray
| ByteBuffer | ||
getByteArrayAt(index:int, length:int):ByteArray
Returns a ByteArray of length size from the buffer starting from the specified position.
| ByteBuffer | ||
getBytes(length:int):Array
Returns specified number of bytes in an array
| ByteBuffer | ||
getBytesAt(index:int, length:int):Array
Returns a byte array of length size from the buffer starting from the specified position.
| ByteBuffer | ||
getHexDump():String
Returns a hex dump of this buffer.
| ByteBuffer | ||
getInt():int
Returns a four-byte number from the buffer at the current position.
| ByteBuffer | ||
getIntAt(index:int):int
Returns a four-byte number from the buffer at the specified index.
| ByteBuffer | ||
getMediumInt():int
Returns a three-byte number from the buffer at the current position.
| ByteBuffer | ||
getMediumIntAt(index:int):int
Returns a three-byte number from the buffer at the specified index.
| ByteBuffer | ||
getPrefixedString(fieldSize:int, cs:Charset):String
Returns a length-prefixed string from the buffer at the current position.
| ByteBuffer | ||
getShort():int
Returns a two-byte number from the buffer at the current position.
| ByteBuffer | ||
getShortAt(index:int):int
Returns a two-byte number from the buffer at the specified index.
| ByteBuffer | ||
Returns a null-terminated string from the buffer at the current position.
| ByteBuffer | ||
getUnsigned():int
Returns an unsigned single-byte number from the buffer at the current position.
| ByteBuffer | ||
getUnsignedAt(index:int):int
Returns an unsigned single-byte number from the buffer at the specified index.
| ByteBuffer | ||
getUnsignedBytes(length:int):Array
Returns specified number of unsigned bytes in an array
| ByteBuffer | ||
getUnsignedInt():int
Returns an unsigned four-byte number from the buffer at the current position.
| ByteBuffer | ||
getUnsignedIntAt(index:int):int
Returns an unsigned four-byte number from the buffer at the specified index.
| ByteBuffer | ||
getUnsignedMediumInt():int
Returns an unsigned three-byte number from the buffer at the current position.
| ByteBuffer | ||
getUnsignedMediumIntAt(index:int):int
Returns an unsigned three-byte number from the buffer at the specified index.
| ByteBuffer | ||
getUnsignedShort():int
Returns an unsigned two-byte number from the buffer at the current position.
| ByteBuffer | ||
getUnsignedShortAt(index:int):int
Returns an unsigned two-byte number from the buffer at the specified index.
| ByteBuffer | ||
hasRemaining():Boolean
Returns true if this buffer has remaining bytes,
false otherwise.
| ByteBuffer | ||
indexOf(b:int):int
Returns the index of the specified byte in the buffer.
| ByteBuffer | ||
Marks a position in the buffer.
| ByteBuffer | ||
markValue():int
Returns the mark position in the buffer.
| ByteBuffer | ||
put(v:int):ByteBuffer
Puts a single byte number into the buffer at the current position.
| ByteBuffer | ||
putAt(index:int, v:int):ByteBuffer
Puts a single byte number into the buffer at the specified index.
| ByteBuffer | ||
Puts a buffer into the buffer at the current position.
| ByteBuffer | ||
Puts a buffer into the buffer at the specified index.
| ByteBuffer | ||
putByteArray(v:ByteArray, offset:int = 0, length:int = 0):ByteBuffer
Puts a single-byte array into the buffer at the current position.
| ByteBuffer | ||
putByteArrayAt(index:int, v:ByteArray, offset:int = 0, length:int = 0):ByteBuffer
Puts a single-byte array into the buffer at the current position.
| ByteBuffer | ||
putBytes(v:Array):ByteBuffer
Puts a single-byte array into the buffer at the current position.
| ByteBuffer | ||
putBytesAt(index:int, v:Array):ByteBuffer
Puts a single-byte array into the buffer at the specified index.
| ByteBuffer | ||
putInt(v:int):ByteBuffer
Puts a four-byte number into the buffer at the current position.
| ByteBuffer | ||
putIntAt(index:int, v:*):ByteBuffer
Puts a four-byte number into the buffer at the specified index.
| ByteBuffer | ||
putMediumInt(v:int):ByteBuffer
Puts a three-byte number into the buffer at the current position.
| ByteBuffer | ||
putMediumIntAt(i:int, v:int):ByteBuffer
Puts a three-byte number into the buffer at the specified index.
| ByteBuffer | ||
Puts a string into the buffer at the specified index, using the
character set to encode the string as bytes.
| ByteBuffer | ||
putShort(v:int):ByteBuffer
Puts a two-byte number into the buffer at the current position.
| ByteBuffer | ||
putShortAt(index:int, v:int):ByteBuffer
Puts a two-byte number into the buffer at the specified index.
| ByteBuffer | ||
Puts a string into the buffer at the current position, using the
character set to encode the string as bytes.
| ByteBuffer | ||
putUnsigned(v:int):ByteBuffer
Puts an unsigned single-byte number into the buffer at the current position.
| ByteBuffer | ||
putUnsignedAt(index:int, v:int):ByteBuffer
Puts an unsigned single-byte number into the buffer at the specified position.
| ByteBuffer | ||
putUnsignedInt(v:uint):ByteBuffer
Puts an unsigned four-byte number into the buffer at the current position.
| ByteBuffer | ||
putUnsignedIntAt(index:int, v:uint):ByteBuffer
Puts an unsigned four-byte number into the buffer at the specified position.
| ByteBuffer | ||
putUnsignedShort(v:int):ByteBuffer
Puts an unsigned two-byte number into the buffer at the current position.
| ByteBuffer | ||
putUnsignedShortAt(index:int, v:int):ByteBuffer
Puts an unsigned two-byte number into the buffer at the specified position.
| ByteBuffer | ||
remaining():int
Returns the number of bytes remaining from the current position to the limit.
| ByteBuffer | ||
Resets the buffer position using the mark.
| ByteBuffer | ||
Rewinds the buffer.
| ByteBuffer | ||
skip(size:int):ByteBuffer
Skips the specified number of bytes from the current position.
| ByteBuffer | ||
Returns a sliced buffer, setting the position to zero, and
decrementing the limit accordingly.
| ByteBuffer | ||
toString():String
Returns the string representation of this buffer.
| ByteBuffer | ||
wrap(bytes:Array):ByteBuffer
[static]
Wraps a byte array as a new ByteBuffer instance.
| ByteBuffer | ||
wrapByteArray(bytes:ByteArray):ByteBuffer
[static]
| ByteBuffer |
array | property |
public var array:Array
The array property provides byte storage for the buffer.
autoExpand | property |
public var autoExpand:Boolean = true
The autoExpand property enables writing variable length data, and is on by default.
capacity | property |
public var capacity:int = 0
The capacity property indicates the maximum number of bytes of storage available if the buffer is not automatically expanding.
limit | property |
public var limit:int = 0
The limit property indicates the last byte of data available for reading.
order | property |
public var order:ByteOrder
The order property indicates the endianness of multibyte integer types in the buffer.
position | property |
public var position:int = 0
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.
ByteBuffer | () | constructor |
public function ByteBuffer(bytes:* = null)
Creates a new ByteBuffer instance.
Parametersbytes:* (default = null ) — bytes the byte-valued Number array
|
allocate | () | method |
public static function allocate(capacity:int):ByteBuffer
Allocates a new ByteBuffer instance. The new buffer's position will be zero, its limit will be its capacity, and its mark will be undefined.
Parameterscapacity:int — the maximum buffer capacity
|
ByteBuffer —
the allocated ByteBuffer
|
clear | () | method |
public function clear():ByteBuffer
Clears the buffer. The position is set to zero, the limit is set to the capacity and the mark is reset.
ReturnsByteBuffer —
the buffer
|
compact | () | method |
public function compact():ByteBuffer
Compacts the buffer by removing leading bytes up to the buffer position, and decrements the limit and position values accordingly.
ReturnsByteBuffer —
the buffer
|
duplicate | () | method |
public function duplicate():ByteBuffer
Duplicates the buffer by reusing the underlying byte array but with independent position, limit and capacity.
ReturnsByteBuffer —
the duplicated buffer
|
expand | () | method |
public function expand(expectedRemaining:int):ByteBuffer
Expands the buffer to support the expected number of remaining bytes after the current position.
ParametersexpectedRemaining:int — expectedRemaining the expected number of remaining bytes
|
ByteBuffer —
the buffer
|
expandAt | () | method |
public function expandAt(i:int, expectedRemaining:int):ByteBuffer
Expands the buffer to support the expected number of remaining bytes at the specified index.
Parametersi:int — i the index
|
|
expectedRemaining:int — expectedRemaining the expected number of remaining bytes
|
ByteBuffer —
the buffer
|
fill | () | method |
public function fill(size:int):ByteBuffer
Fills the buffer with a repeated number of zeros.
Parameterssize:int — the number of zeros to repeat
|
ByteBuffer —
the buffer
|
fillWith | () | method |
public function fillWith(b:int, size:int):ByteBuffer
Fills the buffer with a specific number of repeated bytes.
Parametersb:int — the byte to repeat
|
|
size:int — the number of times to repeat
|
ByteBuffer —
the buffer
|
flip | () | method |
public function flip():ByteBuffer
Flips the buffer. The limit is set to the current position, the position is set to zero, and the mark is reset.
ReturnsByteBuffer —
the flipped buffer
|
get | () | method |
public function get():int
Returns a single-byte number from the buffer at the current position.
Returnsint — the single-byte number
|
getAt | () | method |
public function getAt(index:int):int
Returns a single-byte number from the buffer at the specified index.
Parametersindex:int — the index
|
int — the single-byte number
|
getByteArray | () | method |
public function getByteArray(length:int):ByteArray
Returns bytes in an ByteArray
Parameterslength:int — the number of bytes to read
|
ByteArray — a new ByteArray with bytes read from the buffer
|
getByteArrayAt | () | method |
public function getByteArrayAt(index:int, length:int):ByteArray
Returns a ByteArray of length size from the buffer starting from the specified position.
Parametersindex:int — start index
|
|
length:int — the size of the buffer to be returned
|
ByteArray — a new byte array with bytes read from the buffer
|
getBytes | () | method |
public function getBytes(length:int):Array
Returns specified number of bytes in an array
Parameterslength:int — the number of bytes to read
|
Array — a new byte array with bytes read from the buffer
|
getBytesAt | () | method |
public function getBytesAt(index:int, length:int):Array
Returns a byte array of length size from the buffer starting from the specified position.
Parametersindex:int — start index
|
|
length:int — the size of the buffer to be returned
|
Array — a new byte array with bytes read from the buffer
|
getHexDump | () | method |
public function getHexDump():String
Returns a hex dump of this buffer.
ReturnsString — the hex dump
|
getInt | () | method |
public function getInt():int
Returns a four-byte number from the buffer at the current position.
Returnsint — the four-byte number
|
getIntAt | () | method |
public function getIntAt(index:int):int
Returns a four-byte number from the buffer at the specified index.
Parametersindex:int — the index
|
int — the four-byte number
|
getMediumInt | () | method |
public function getMediumInt():int
Returns a three-byte number from the buffer at the current position.
Returnsint — the three-byte number
|
getMediumIntAt | () | method |
public function getMediumIntAt(index:int):int
Returns a three-byte number from the buffer at the specified index.
Parametersindex:int — the index
|
int — the three-byte number
|
getPrefixedString | () | method |
public function getPrefixedString(fieldSize:int, cs:Charset):String
Returns a length-prefixed string from the buffer at the current position.
ParametersfieldSize:int — fieldSize the width in bytes of the prefixed length field
|
|
cs:Charset — cs the character set
|
String — the length-prefixed string
|
getShort | () | method |
public function getShort():int
Returns a two-byte number from the buffer at the current position.
Returnsint — the two-byte number
|
getShortAt | () | method |
public function getShortAt(index:int):int
Returns a two-byte number from the buffer at the specified index.
Parametersindex:int — the index
|
int — the two-byte number
|
getString | () | method |
public function getString(cs:Charset):String
Returns a null-terminated string from the buffer at the current position. If the end of buffer if reached before discovering a null terminator byte, then the decoded string includes all bytes up to the end of the buffer.
Parameterscs:Charset — cs the character set
|
String — the null-terminated string
|
getUnsigned | () | method |
public function getUnsigned():int
Returns an unsigned single-byte number from the buffer at the current position.
Returnsint — the unsigned single-byte number
|
getUnsignedAt | () | method |
public function getUnsignedAt(index:int):int
Returns an unsigned single-byte number from the buffer at the specified index.
Parametersindex:int — the index
|
int — the unsigned single-byte number
|
getUnsignedBytes | () | method |
public function getUnsignedBytes(length:int):Array
Returns specified number of unsigned bytes in an array
Parameterslength:int — the number of bytes to read
|
Array — array of unsigned bytes
|
getUnsignedInt | () | method |
public function getUnsignedInt():int
Returns an unsigned four-byte number from the buffer at the current position.
Returnsint — the unsigned four-byte number
|
getUnsignedIntAt | () | method |
public function getUnsignedIntAt(index:int):int
Returns an unsigned four-byte number from the buffer at the specified index.
Parametersindex:int — the index
|
int — the unsigned four-byte number
|
getUnsignedMediumInt | () | method |
public function getUnsignedMediumInt():int
Returns an unsigned three-byte number from the buffer at the current position.
Returnsint — the unsigned three-byte number
|
getUnsignedMediumIntAt | () | method |
public function getUnsignedMediumIntAt(index:int):int
Returns an unsigned three-byte number from the buffer at the specified index.
Parametersindex:int — the index
|
int — the unsigned three-byte number
|
getUnsignedShort | () | method |
public function getUnsignedShort():int
Returns an unsigned two-byte number from the buffer at the current position.
Returnsint — the unsigned two-byte number
|
getUnsignedShortAt | () | method |
public function getUnsignedShortAt(index:int):int
Returns an unsigned two-byte number from the buffer at the specified index.
Parametersindex:int — the index
|
int — the unsigned two-byte number
|
hasRemaining | () | method |
public function hasRemaining():Boolean
Returns true if this buffer has remaining bytes, false otherwise.
ReturnsBoolean — whether this buffer has remaining bytes
|
indexOf | () | method |
public function indexOf(b:int):int
Returns the index of the specified byte in the buffer.
Parametersb:int — the byte to find
|
int — the index of the byte in the buffer, or -1 if not found
|
mark | () | method |
public function mark():ByteBuffer
Marks a position in the buffer.
ReturnsByteBuffer —
the buffer
|
See also
markValue | () | method |
public function markValue():int
Returns the mark position in the buffer.
Returnsint — the mark position
|
See also
put | () | method |
public function put(v:int):ByteBuffer
Puts a single byte number into the buffer at the current position.
Parametersv:int — the single-byte number
|
ByteBuffer —
the buffer
|
putAt | () | method |
public function putAt(index:int, v:int):ByteBuffer
Puts a single byte number into the buffer at the specified index.
Parametersindex:int — the index
|
|
v:int — the single-byte number
|
ByteBuffer —
the buffer
|
putBuffer | () | method |
public function putBuffer(v:ByteBuffer):ByteBuffer
Puts a buffer into the buffer at the current position.
Parametersv:ByteBuffer — the single-byte array
|
ByteBuffer —
the buffer
|
putBufferAt | () | method |
public function putBufferAt(index:int, v:ByteBuffer):ByteBuffer
Puts a buffer into the buffer at the specified index.
Parametersindex:int — the index
|
|
v:ByteBuffer — the single-byte array
|
ByteBuffer —
the buffer
|
putByteArray | () | method |
public function putByteArray(v:ByteArray, offset:int = 0, length:int = 0):ByteBuffer
Puts a single-byte array into the buffer at the current position.
Parametersv:ByteArray — the single-byte array
|
|
offset:int (default = 0 )
|
|
length:int (default = 0 )
|
ByteBuffer —
the buffer
|
putByteArrayAt | () | method |
public function putByteArrayAt(index:int, v:ByteArray, offset:int = 0, length:int = 0):ByteBuffer
Puts a single-byte array into the buffer at the current position.
Parametersindex:int — the index
|
|
v:ByteArray — the single-byte array
|
|
offset:int (default = 0 )
|
|
length:int (default = 0 )
|
ByteBuffer —
the buffer
|
putBytes | () | method |
public function putBytes(v:Array):ByteBuffer
Puts a single-byte array into the buffer at the current position.
Parametersv:Array — the single-byte array
|
ByteBuffer —
the buffer
|
putBytesAt | () | method |
public function putBytesAt(index:int, v:Array):ByteBuffer
Puts a single-byte array into the buffer at the specified index.
Parametersindex:int — the index
|
|
v:Array — the single-byte array
|
ByteBuffer —
the buffer
|
putInt | () | method |
public function putInt(v:int):ByteBuffer
Puts a four-byte number into the buffer at the current position.
Parametersv:int — the four-byte number
|
ByteBuffer —
the buffer
|
putIntAt | () | method |
public function putIntAt(index:int, v:*):ByteBuffer
Puts a four-byte number into the buffer at the specified index.
Parametersindex:int — the index
|
|
v:* — the four-byte number
|
ByteBuffer —
the buffer
|
putMediumInt | () | method |
public function putMediumInt(v:int):ByteBuffer
Puts a three-byte number into the buffer at the current position.
Parametersv:int — the three-byte number
|
ByteBuffer —
the buffer
|
putMediumIntAt | () | method |
public function putMediumIntAt(i:int, v:int):ByteBuffer
Puts a three-byte number into the buffer at the specified index.
Parametersi:int — the index
|
|
v:int — the three-byte number
|
ByteBuffer —
the buffer
|
putPrefixedString | () | method |
public function putPrefixedString(fieldSize:int, v:String, cs:Charset):ByteBuffer
Puts a string into the buffer at the specified index, using the character set to encode the string as bytes.
ParametersfieldSize:int — the width in bytes of the prefixed length field
|
|
v:String — the string
|
|
cs:Charset — the character set
|
ByteBuffer —
the buffer
|
putShort | () | method |
public function putShort(v:int):ByteBuffer
Puts a two-byte number into the buffer at the current position.
Parametersv:int — the two-byte number
|
ByteBuffer —
the buffer
|
putShortAt | () | method |
public function putShortAt(index:int, v:int):ByteBuffer
Puts a two-byte number into the buffer at the specified index.
Parametersindex:int — the index
|
|
v:int — the two-byte number
|
ByteBuffer —
the buffer
|
putString | () | method |
public function putString(v:String, cs:Charset):ByteBuffer
Puts a string into the buffer at the current position, using the character set to encode the string as bytes.
Parametersv:String — the string
|
|
cs:Charset — the character set
|
ByteBuffer —
the buffer
|
putUnsigned | () | method |
public function putUnsigned(v:int):ByteBuffer
Puts an unsigned single-byte number into the buffer at the current position.
Parametersv:int — the unsigned byte as an int
|
ByteBuffer —
the buffer
|
putUnsignedAt | () | method |
public function putUnsignedAt(index:int, v:int):ByteBuffer
Puts an unsigned single-byte number into the buffer at the specified position.
Parametersindex:int — the index
|
|
v:int — the unsigned byte as an int
|
ByteBuffer —
the buffer
|
putUnsignedInt | () | method |
public function putUnsignedInt(v:uint):ByteBuffer
Puts an unsigned four-byte number into the buffer at the current position.
Parametersv:uint — the four-byte number
|
ByteBuffer —
the buffer
|
putUnsignedIntAt | () | method |
public function putUnsignedIntAt(index:int, v:uint):ByteBuffer
Puts an unsigned four-byte number into the buffer at the specified position.
Parametersindex:int — the index
|
|
v:uint — the four-byte number
|
ByteBuffer —
the buffer
|
putUnsignedShort | () | method |
public function putUnsignedShort(v:int):ByteBuffer
Puts an unsigned two-byte number into the buffer at the current position.
Parametersv:int — the two-byte number
|
ByteBuffer —
the buffer
|
putUnsignedShortAt | () | method |
public function putUnsignedShortAt(index:int, v:int):ByteBuffer
Puts an unsigned two-byte number into the buffer at the specified position.
Parametersindex:int — the index
|
|
v:int — the two-byte number
|
ByteBuffer —
the buffer
|
remaining | () | method |
public function remaining():int
Returns the number of bytes remaining from the current position to the limit.
Returnsint — the number of bytes remaining
|
reset | () | method |
public function reset():ByteBuffer
Resets the buffer position using the mark.
ReturnsByteBuffer —
the buffer
|
— if the mark is invalid
|
See also
rewind | () | method |
public function rewind():ByteBuffer
Rewinds the buffer. The position is set to zero and the mark is reset.
ReturnsByteBuffer —
the buffer
|
skip | () | method |
public function skip(size:int):ByteBuffer
Skips the specified number of bytes from the current position.
Parameterssize:int — size the number of bytes to skip
|
ByteBuffer —
the buffer
|
slice | () | method |
public function slice():ByteBuffer
Returns a sliced buffer, setting the position to zero, and decrementing the limit accordingly.
ReturnsByteBuffer —
the sliced buffer
|
toString | () | method |
public function toString():String
Returns the string representation of this buffer.
ReturnsString — the string representation
|
wrap | () | method |
public static function wrap(bytes:Array):ByteBuffer
Wraps a byte array as a new ByteBuffer instance.
Parametersbytes:Array — an array of byte-sized numbers
|
ByteBuffer —
the bytes wrapped as a ByteBuffer
|
wrapByteArray | () | method |
public static function wrapByteArray(bytes:ByteArray):ByteBuffer
Parameters
bytes:ByteArray |
ByteBuffer |