OScript API/Built-in Package Index |
The Bytes Package provides a set of functions for creating, inserting data into, and extracting data from instances of the Bytes datatype.
The functions offered here support the creation of a Bytes (Allocate() and NewFromString()), storing values into a Bytes (various Put functions), and retrieving values from a Bytes (various Get functions). The values supported are the following:
The flag constant indicating that Put operations should modify the passed Bytes instead of a returned copy.
The flag constant indicating that Put and Get operations should swap bytes, if necessary, to maintain PC byte-order (little endian) compatibility.
Allocates a new Bytes of the given size.
Congerts base64 encoded string to a byte array.
Returns a subrange of the specified Bytes.
Returns a String stored in the Bytes as a null-terminated string.
Returns the Integer value of a signed byte in a Bytes.
Returns an Integer from a signed, 2-byte value in a Bytes.
Returns an Integer from a signed, 4-byte value in a Bytes.
Returns an Integer from a signed, 8-byte value in a Bytes.
Returns a subrange of Bytes from a Bytes as prepended by a signed length indication.
Returns a String from a Bytes as prepended by a signed length indication.
Returns a subrange of Bytes from a Bytes as prepended by an unsigned length indication.
Returns a Point from a Bytes.
Returns a String from a Bytes as prepended by an unsigned length indication (a Pascal String).
Returns a Real from a 4-byte value in a Bytes.
Returns a Real from a 8-byte value in a Bytes.
Returns a String extracted from the Bytes at the given index.
Returns an Integer from a single byte unsigned value in a Bytes.
Returns an Integer from a 2-byte unsigned value in a Bytes.
Returns an Integer from a 4-byte unsigned value in a Bytes.
Returns a new Bytes containing the given String.
Puts the contents of a Bytes into a Bytes.
Puts a String into a Bytes terminating it with a null byte (as a C language String).
Puts an Integer into a Bytes as a single byte signed value.
Puts an Integer into a Bytes as a 2-byte signed value.
Puts an Integer into a Bytes as a 4-byte signed value.
Puts an Integer into a Bytes as a 8-byte signed value.
Puts the contents of a Bytes into a Bytes, prepended by a signed 4-byte length indication.
Puts a String into a bytes, prepended by a 4-byte signed length indication.
Puts the contents of a Bytes into a Bytes, prepended by an unsigned 4-byte length indication.
Puts a Point into a Bytes.
Puts a String into a bytes, prepended by a 4-byte unsigned length indication (as a Pascal String).
Puts a Real into a Bytes as a 4-byte value.
Puts a Real into a Bytes as an 8-byte value.
Puts a String into a Bytes.
Puts an Integer into a Bytes as a single byte unsigned value.
Puts an Integer into a Bytes as a 2-byte unsigned value.
Puts an Integer into a Bytes as a 4-byte unsigned value.
Converts a byte array into a base64 encoded string.
The flag constant indicating that Put operations should modify the passed Bytes instead of a returned copy.
The flag constant indicating that Put and Get operations should swap bytes, if necessary, to maintain PC byte-order (little endian) compatibility.
Allocates a new Bytes of the specified size.
The size, in bytes,
A new Bytes of size size.
The Bytes allocated will be filled with zero values. See Bytes.GetBytes() for an example.
Congerts a base64 encoded string to a byte array.
A base64 encoded string
A new Bytes converted from a string.
The Bytes allocated will be filled with zero values. See Bytes.GetBytes() for an example.
Returns a subrange of the bytes in b from index startidx of length len as a new Bytes.
The Bytes from which a subrange is extracted.
The starting index from which to extract the subrange.
The length of the subrange to extract.
A new Bytes which is the specified
Note that startidx and len are not necessarily bounds-checked, meaning that it is the responsibility of the caller to ensure that a valid subrange is specified. See Bytes.GetLBytes() and Bytes.GetPBytes(). Here is a short example:
Bytes b = Bytes.Allocate( 10 ) Integer i for ( i = 0; i < 10; i += 1 ) Bytes.PutI1( b, i, i, Bytes.InPlace ) end Echo( "b = ", b, "; b[2..4] = ", Bytes.GetBytes( b, 2, 4 ) )
The output of the example is:
b = [00010203040506070809]; b[2..4] = [02030405]
Extracts a C-style null-terminated String from the Bytes at the specified index.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format (which currently has no effect).
The extracted String value.
Returns a single byte signed integer from the specified Bytes at the specified index.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted Integer value.
See Bytes.PutI1() for an example.
Returns a 2-byte signed integer from the specified Bytes at the specified index.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted Integer value.
Returns a 4-byte signed integer from the specified Bytes at the specified index.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted Integer value.
Returns a 8-byte signed integer from the specified Bytes at the specified index.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted Integer value.
Returns a new Bytes extracted from the specified Bytes at index startidx, which points to a 4-byte signed integer indicating the number of following bytes to extract.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted Bytes.
Returns a new String extracted from the specified Bytes at index startidx, which points to a 4-byte signed integer indicating the number of following bytes to extract as the String.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted String value.
Returns a new Bytes extracted from the specified Bytes as Pascal bytes at index startidx, which points to a 4-byte unsigned integer indicating the number of following bytes to extract.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted Bytes.
Returns a new Point extracted from the Bytes at the specified index.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted Point value.
Returns a new String extracted from the specified Bytes as a Pascal String at index startidx, which points to a 4-byte unsigned integer indicating the number of following bytes to extract as the String.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted String value.
Returns a 4-byte real (floating point value) from the specified Bytes at the specified index.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted Real value.
Returns an 8-byte real (floating point value) from the specified Bytes at the specified index.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted Real value.
Returns a String extracted from the Bytes at the given index.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, the maximum String length to return.
Not used.
The extracted String value.
Returns a single byte unsigned integer from the specified Bytes at the specified index.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted Integer value.
Returns a 2-byte unsigned integer from the specified Bytes at the specified index.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted Integer value.
Returns a 4-byte unsigned integer from the specified Bytes at the specified index.
The Bytes from which the value is extracted.
The index in the Bytes of the value to extract.
If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.
The extracted Integer value.
Note OScript's Integer values are always signed, so on platforms where integer values are 32-bits native, Bytes.GetU4() will return the same value as Bytes.GetI4().
Creates and returns a new Bytes containing the given String.
The String to add to the new Bytes.
A new Bytes the size of the given String and containing exactly that String.
Puts the entire, exact contents of the specified Bytes, val, into b.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The Bytes value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
See Bytes.PutLBytes() and Bytes.PutPBytes().
Puts the specified String into the specified Bytes, terminating the String with a single null byte as is commonly done with C language strings.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the given Integer into the Bytes as a signed, single-byte value.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Here is a short example:
Bytes b = Bytes.Allocate( 10 ) Bytes.PutI1( b, 3, 2, Bytes.InPlace ) Echo( "b = ", b, "; b[3] = ", Bytes.GetI1( b, 3 ) )
The output of the example is:
b = [00000002000000000000]; b[3] = 2
Puts the given Integer into the Bytes as a signed, 2-byte value.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the given Integer into the Bytes as a signed, 4-byte value.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the given Integer into the Bytes as a signed, 8-byte value.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the entire contents of the Bytes, val, into the given Bytes, b, prepending the value inserted with a 4-byte, signed integer length indicator.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
See Bytes.PutPBytes() and Bytes.PutBytes().
Puts the given String into the Bytes, prepending it with a 4-byte signed integer length indicator.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the contents of the given Bytes into the Bytes, prepending it with a 4-byte, unsigned integer length indicator (see Bytes.PutPString()).
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the given Point into the Bytes as two, signed, 4-byte values.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the given String into the Bytes, prepending the String with a 4-byte, unsigned integer length indicator, as is commonly done with Pascal strings.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the given Real into the Bytes as a 4-byte value.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the given Real into the Bytes as an 8-byte value.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the given Integer into the Bytes as a signed, 4-byte value.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the given Integer into the Bytes as an unsigned, 4-byte value.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the given Integer into the Bytes as an unsigned, 4-byte value.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Puts the given Integer into the Bytes as an unsigned, 4-byte value.
The Bytes, or a copy of this Bytes, into which the value is put.
The index in the Bytes of where to put the value.
The value to put.
If specified, Bytes.InPlace if the value should be put into the original Bytes instead of a copy, and/or Bytes.Swap if PC-compatible byte-order should be maintained (use bitwise or to combine the two flags). By default, the value is put into a copy, and the byte-order maintained is that native to the platform running the server.
The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.
Converts a byte array into a base64 encoded string.
The Bytes to be converted.
a string converted from the input Byte array.
Copyright © 2021 OpenText Corporation. All rights reserved. |