Data
super: NSData
Data class provide object-oriented wrappers for byte buffers.
Events
-
Load() This event is called when the object becames available in the current runtime system.
-
Unload() This event is called when the object has been removed from the current runtime system (but not yet deallocated).
Constructors
- func Data() Instantiate a new Data object.
Methods
-
func bytes(range: Range): Data Copies a range of bytes from the receiver’s data.
-
func append(value: Object) Appends to the receiver a given number of bytes from a given buffer. It supports numbers (64 bits representation) strings and Data.
-
func writeUInt8(value: Int) Writes a one-byte unsigned integer value to the data. Replaces the previous byte if the current
position
of the receiver is equal to the receiver's length, otherwise appends the byte to the receiver. See also theposition
property. -
func writeUInt16(value: Int) Writes a two-bytes unsigned integer value to the data. Replaces the previous byte if the current
position
of the receiver is equal to the receiver's length, otherwise appends the byte to the receiver. See also theposition
and thelittleEndian
properties. -
func writeUInt32(value: Int) Writes a four-bytes unsigned integer value to the data. Replaces the previous byte if the current
position
of the receiver is equal to the receiver's length, otherwise appends the byte to the receiver. See also theposition
and thelittleEndian
properties. -
func writeUInt64(value: Int) Writes a eight-bytes unsigned integer value to the data. Replaces the previous byte if the current
position
of the receiver is equal to the receiver's length, otherwise appends the byte to the receiver. See also theposition
and thelittleEndian
properties. -
func writeInt8(value: Int) Writes a one-byte signed integer value to the data. Replaces the previous byte if the current
position
of the receiver is equal to the receiver's length, otherwise appends the byte to the receiver. See also theposition
property. -
func writeInt16(value: Int) Writes a two-bytes signed integer value to the data. Replaces the previous byte if the current
position
of the receiver is equal to the receiver's length, otherwise appends the byte to the receiver. See also theposition
and thelittleEndian
properties. -
func writeInt32(value: Int) Writes a four-bytes signed integer value to the data. Replaces the previous byte if the current
position
of the receiver is equal to the receiver's length, otherwise appends the byte to the receiver. See also theposition
and thelittleEndian
properties. -
func writeInt64(value: Int) Writes a eight-bytes signed integer value to the data. Replaces the previous byte if the current
position
of the receiver is equal to the receiver's length, otherwise appends the byte to the receiver. See also theposition
and thelittleEndian
properties. -
func writeFloat(value: Float) Writes a four-bytes float value to the data. Replaces the previous byte if the current
position
of the receiver is equal to the receiver's length, otherwise appends the byte to the receiver. See also theposition
and thelittleEndian
properties. -
func writeDouble(value: Float) Writes a eight-bytes double value to the data. Replaces the previous byte if the current
position
of the receiver is equal to the receiver's length, otherwise appends the byte to the receiver. See also theposition
and thelittleEndian
properties.