## ByteArray(data)

Constructor

#### # new ByteArray(data)

Create an empty ByteArray. ByteArrays can be used to very fast store a large number of byte values (0..255). They are supported mainly for File/Zip/Socket IO.

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | `Array.<number>` | `Array.<string>` | `string` | numbers will be used as given, string arrays will be intepreted as "characters" and only the first char is added to the ByteArray. Strings will be added char by char.

See:
  - File
  - Zip
  - Socket
  - Curl

# Members

Type: `number`

#### # alloc_size

current allocation size of ByteArray (internal value).

Type: `number`

#### # length

current number of entries in ByteArray.

# Methods

#### # Append(data)

append the contents of the Javascript array to the ByteArray.

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | `Array.<number>` | `Array.<string>` | numbers will be used as given, string arrays will be intepreted as "characters" and only the first char is added to the ByteArray. Strings will be added char by char.

#### # Clear()

truncate ByteArray to zero length. Note: this does not free any memory, it just declares the length of the array as 0.

#### # Get(idx) → {number}

get value from specific index.

##### Parameters:

Name | Type | Description
--- | --- | ---
`idx` | `number` | the indext to retrieve.

Returns:

the store value.

Type: `number`

#### # Pop() → {number}

retrieve and remove the last value in the ByteArray.

Returns:

the former last value.

Type: `number`

#### # Push(val)

append value to ByteArray.

##### Parameters:

Name | Type | Description
--- | --- | ---
`val` | `number` | the new value.

#### # Set(idx, val)

replace value at the given index.

##### Parameters:

Name | Type | Description
--- | --- | ---
`idx` | `number` | the indext to change.
`val` | `number` | the new value.

#### # Shift() → {number}

retrieve and remove the first value in the ByteArray.

Returns:

the former first value.

Type: `number`