Contains miscellaneous utilities.
Functions
| string BytesToString |
( |
object |
array |
) |
Returns a string given an array of integers in which each of them represents a 7-bit ASCII encoded character.
Parameters:
-
| array |
The array of integers to be returned as a string. |
- Returns:
- The string representation of the given array.
| object StringToBytes |
( |
string |
text |
) |
Returns an array of integers each of which is the 7-bit ASCII representation of each character in the given string.
Parameters:
-
| text |
The string to be returned as an array. |
- Returns:
- An array of integers representing the given string.
| WebResponseObject WebRequest |
( |
string |
url |
, |
string |
method |
, |
object |
headers |
, |
object |
body |
, |
int |
timeout |
) |
Sends an HTTP request to the server and receives a response.
This function blocks the UI thread, and the application might freeze while sending or receiving a large amount of data.
- Parameters:
-
| url |
A string that identifies the internet resource. |
-
| method |
The protocol method to use in this request. |
-
| headers |
A JavaScript Object containing the headers to be used in this request, or null of no headers are needed. Each of the object's property names must match an HTTP header name and have the desired value for this header as a string. |
-
| body |
Either a string or an array of numbers representing the body of the request being sent, or null if no body is needed. If an array of numbers is used, each of these numbers represents a byte in the body. In consequence, their values must be integers no larger then 255 and no smaller than 0. |
-
| timeout |
Integer that specifies the number of milliseconds to wait before the request times out. |
- Returns:
- A WebResponseObject representing the server's response or null if an error occurred.
Properties
If the last action performed by this object caused an error, this property gets a description of it. Otherwise it gets an empty string.