OScript API/Built-in Package Index

Class: Bytes

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:

  • Integers as signed or unsigned values occupying 1, 2, or 4 bytes.
  • Reals occupying either 4 or 8 bytes.
  • Points.
  • Bytes, which may be prepended with a signed or unsigned 4-byte length indication.
  • Strings either explicitly, null-terminated (C-style), or prepended with a signed or unsigned (Pascal-style) 4-byte length indication.

Class Attributes

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.

Class Methods

Allocate( Integer size )

Allocates a new Bytes of the given size.

FromBase64( String inputString )

Congerts base64 encoded string to a byte array.

GetBytes( Bytes b, Integer startidx, Integer len )

Returns a subrange of the specified Bytes.

GetCString( Bytes b, Integer startIdx, [Integer flags] )

Returns a String stored in the Bytes as a null-terminated string.

GetI1( Bytes b, Integer startidx, [Integer flags] )

Returns the Integer value of a signed byte in a Bytes.

GetI2( Bytes b, Integer startidx, [Integer flags] )

Returns an Integer from a signed, 2-byte value in a Bytes.

GetI4( Bytes b, Integer startidx, [Integer flags] )

Returns an Integer from a signed, 4-byte value in a Bytes.

GetI8( Bytes b, Integer startidx, [Integer flags] )

Returns an Integer from a signed, 8-byte value in a Bytes.

GetLBytes( Bytes b, Integer startidx, [Integer flags] )

Returns a subrange of Bytes from a Bytes as prepended by a signed length indication.

GetLString( Bytes b, Integer startidx, [Integer flags] )

Returns a String from a Bytes as prepended by a signed length indication.

GetPBytes( Bytes b, Integer startidx, [Integer flags] )

Returns a subrange of Bytes from a Bytes as prepended by an unsigned length indication.

GetPoint( Bytes b, Integer startidx, [Integer flags] )

Returns a Point from a Bytes.

GetPString( Bytes b, Integer startidx, [Integer flags] )

Returns a String from a Bytes as prepended by an unsigned length indication (a Pascal String).

GetR4( Bytes b, Integer startidx, [Integer flags] )

Returns a Real from a 4-byte value in a Bytes.

GetR8( Bytes b, Integer startidx, [Integer flags] )

Returns a Real from a 8-byte value in a Bytes.

GetString( Bytes b, Integer startidx, [Integer maxlen], [Integer flags] )

Returns a String extracted from the Bytes at the given index.

GetU1( Bytes b, Integer startidx, [Integer flags] )

Returns an Integer from a single byte unsigned value in a Bytes.

GetU2( Bytes b, Integer startidx, [Integer flags] )

Returns an Integer from a 2-byte unsigned value in a Bytes.

GetU4( Bytes b, Integer startidx, [Integer flags] )

Returns an Integer from a 4-byte unsigned value in a Bytes.

NewFromString( String s )

Returns a new Bytes containing the given String.

PutBytes( Bytes b, Integer startidx, Bytes val, [Integer flags] )

Puts the contents of a Bytes into a Bytes.

PutCString( Bytes b, Integer startidx, String val, [Integer flags] )

Puts a String into a Bytes terminating it with a null byte (as a C language String).

PutI1( Bytes b, Integer startidx, Integer val, [Integer flags] )

Puts an Integer into a Bytes as a single byte signed value.

PutI2( Bytes b, Integer startidx, Integer val, [Integer flags] )

Puts an Integer into a Bytes as a 2-byte signed value.

PutI4( Bytes b, Integer startidx, Integer val, [Integer flags] )

Puts an Integer into a Bytes as a 4-byte signed value.

PutI8( Bytes b, Integer startidx, Integer val, [Integer flags] )

Puts an Integer into a Bytes as a 8-byte signed value.

PutLBytes( Bytes b, Integer startidx, Bytes val, [Integer flags] )

Puts the contents of a Bytes into a Bytes, prepended by a signed 4-byte length indication.

PutLString( Bytes b, Integer startidx, String val, [Integer flags] )

Puts a String into a bytes, prepended by a 4-byte signed length indication.

PutPBytes( Bytes b, Integer startidx, Bytes val, [Integer flags] )

Puts the contents of a Bytes into a Bytes, prepended by an unsigned 4-byte length indication.

PutPoint( Bytes b, Integer startidx, Point val, [Integer flags] )

Puts a Point into a Bytes.

PutPString( Bytes b, Integer startidx, String val, [Integer flags] )

Puts a String into a bytes, prepended by a 4-byte unsigned length indication (as a Pascal String).

PutR4( Bytes b, Integer startidx, Real val, [Integer flags] )

Puts a Real into a Bytes as a 4-byte value.

PutR8( Bytes b, Integer startidx, Real val, [Integer flags] )

Puts a Real into a Bytes as an 8-byte value.

PutString( Bytes b, Integer startidx, String val, [Integer flags] )

Puts a String into a Bytes.

PutU1( Bytes b, Integer startidx, Integer val, [Integer flags] )

Puts an Integer into a Bytes as a single byte unsigned value.

PutU2( Bytes b, Integer startidx, Integer val, [Integer flags] )

Puts an Integer into a Bytes as a 2-byte unsigned value.

PutU4( Bytes b, Integer startidx, Integer val, [Integer flags] )

Puts an Integer into a Bytes as a 4-byte unsigned value.

ToBase64( Bytes b )

Converts a byte array into a base64 encoded string.

Class Attributes

Integer InPlace

The flag constant indicating that Put operations should modify the passed Bytes instead of a returned copy.

Integer Swap

The flag constant indicating that Put and Get operations should swap bytes, if necessary, to maintain PC byte-order (little endian) compatibility.

Class Methods

Allocate

Bytes Allocate( Integer size )

Allocates a new Bytes of the specified size.

Parameters

size

The size, in bytes,

Returns:

A new Bytes of size size.

Example

The Bytes allocated will be filled with zero values. See Bytes.GetBytes() for an example.

FromBase64

Bytes FromBase64( String inputString )

Congerts a base64 encoded string to a byte array.

Parameters

inputString

A base64 encoded string

Returns:

A new Bytes converted from a string.

Example

The Bytes allocated will be filled with zero values. See Bytes.GetBytes() for an example.

GetBytes

Bytes GetBytes( Bytes b,
                Integer startidx,
                Integer len )

Returns a subrange of the bytes in b from index startidx of length len as a new Bytes.

Parameters

b

The Bytes from which a subrange is extracted.

startidx

The starting index from which to extract the subrange.

len

The length of the subrange to extract.

Returns:

A new Bytes which is the specified

Example

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]

GetCString

String GetCString( Bytes b,
                   Integer startIdx,
                   [Integer flags] )

Extracts a C-style null-terminated String from the Bytes at the specified index.

Parameters

b

The Bytes from which the value is extracted.

startIdx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format (which currently has no effect).

Returns:

The extracted String value.

GetI1

Integer GetI1( Bytes b,
               Integer startidx,
               [Integer flags] )

Returns a single byte signed integer from the specified Bytes at the specified index.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted Integer value.

Example

See Bytes.PutI1() for an example.

GetI2

Integer GetI2( Bytes b,
               Integer startidx,
               [Integer flags] )

Returns a 2-byte signed integer from the specified Bytes at the specified index.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted Integer value.

GetI4

Integer GetI4( Bytes b,
               Integer startidx,
               [Integer flags] )

Returns a 4-byte signed integer from the specified Bytes at the specified index.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted Integer value.

GetI8

Integer GetI8( Bytes b,
               Integer startidx,
               [Integer flags] )

Returns a 8-byte signed integer from the specified Bytes at the specified index.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted Integer value.

GetLBytes

Bytes GetLBytes( Bytes b,
                 Integer startidx,
                 [Integer flags] )

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.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted Bytes.

GetLString

String GetLString( Bytes b,
                   Integer startidx,
                   [Integer flags] )

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.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted String value.

GetPBytes

Bytes GetPBytes( Bytes b,
                 Integer startidx,
                 [Integer flags] )

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.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted Bytes.

GetPoint

Point GetPoint( Bytes b,
                Integer startidx,
                [Integer flags] )

Returns a new Point extracted from the Bytes at the specified index.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted Point value.

GetPString

String GetPString( Bytes b,
                   Integer startidx,
                   [Integer flags] )

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.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted String value.

GetR4

Real GetR4( Bytes b,
            Integer startidx,
            [Integer flags] )

Returns a 4-byte real (floating point value) from the specified Bytes at the specified index.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted Real value.

GetR8

Real GetR8( Bytes b,
            Integer startidx,
            [Integer flags] )

Returns an 8-byte real (floating point value) from the specified Bytes at the specified index.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted Real value.

GetString

String GetString( Bytes b,
                  Integer startidx,
                  [Integer maxlen],
                  [Integer flags] )

Returns a String extracted from the Bytes at the given index.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

maxlen

If specified, the maximum String length to return.

flags

Not used.

Returns:

The extracted String value.

GetU1

Integer GetU1( Bytes b,
               Integer startidx,
               [Integer flags] )

Returns a single byte unsigned integer from the specified Bytes at the specified index.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted Integer value.

GetU2

Integer GetU2( Bytes b,
               Integer startidx,
               [Integer flags] )

Returns a 2-byte unsigned integer from the specified Bytes at the specified index.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted Integer value.

GetU4

Integer GetU4( Bytes b,
               Integer startidx,
               [Integer flags] )

Returns a 4-byte unsigned integer from the specified Bytes at the specified index.

Parameters

b

The Bytes from which the value is extracted.

startidx

The index in the Bytes of the value to extract.

flags

If specified, Bytes.Swap to retrieve the value maintaining PC byte-compatible format.

Returns:

The extracted Integer value.

Example

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().

NewFromString

Bytes NewFromString( String s )

Creates and returns a new Bytes containing the given String.

Parameters

s

The String to add to the new Bytes.

Returns:

A new Bytes the size of the given String and containing exactly that String.

PutBytes

Bytes PutBytes( Bytes b,
                Integer startidx,
                Bytes val,
                [Integer flags] )

Puts the entire, exact contents of the specified Bytes, val, into b.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The Bytes value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

Example

PutCString

Bytes PutCString( Bytes b,
                  Integer startidx,
                  String val,
                  [Integer flags] )

Puts the specified String into the specified Bytes, terminating the String with a single null byte as is commonly done with C language strings.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutI1

Bytes PutI1( Bytes b,
             Integer startidx,
             Integer val,
             [Integer flags] )

Puts the given Integer into the Bytes as a signed, single-byte value.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

Example

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

PutI2

Bytes PutI2( Bytes b,
             Integer startidx,
             Integer val,
             [Integer flags] )

Puts the given Integer into the Bytes as a signed, 2-byte value.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutI4

Bytes PutI4( Bytes b,
             Integer startidx,
             Integer val,
             [Integer flags] )

Puts the given Integer into the Bytes as a signed, 4-byte value.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutI8

Bytes PutI8( Bytes b,
             Integer startidx,
             Integer val,
             [Integer flags] )

Puts the given Integer into the Bytes as a signed, 8-byte value.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutLBytes

Bytes PutLBytes( Bytes b,
                 Integer startidx,
                 Bytes val,
                 [Integer flags] )

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.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

Example

PutLString

Bytes PutLString( Bytes b,
                  Integer startidx,
                  String val,
                  [Integer flags] )

Puts the given String into the Bytes, prepending it with a 4-byte signed integer length indicator.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutPBytes

Bytes PutPBytes( Bytes b,
                 Integer startidx,
                 Bytes val,
                 [Integer flags] )

Puts the contents of the given Bytes into the Bytes, prepending it with a 4-byte, unsigned integer length indicator (see Bytes.PutPString()).

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutPoint

Bytes PutPoint( Bytes b,
                Integer startidx,
                Point val,
                [Integer flags] )

Puts the given Point into the Bytes as two, signed, 4-byte values.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutPString

Bytes PutPString( Bytes b,
                  Integer startidx,
                  String val,
                  [Integer flags] )

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.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutR4

Bytes PutR4( Bytes b,
             Integer startidx,
             Real val,
             [Integer flags] )

Puts the given Real into the Bytes as a 4-byte value.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutR8

Bytes PutR8( Bytes b,
             Integer startidx,
             Real val,
             [Integer flags] )

Puts the given Real into the Bytes as an 8-byte value.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutString

Bytes PutString( Bytes b,
                 Integer startidx,
                 String val,
                 [Integer flags] )

Puts the given Integer into the Bytes as a signed, 4-byte value.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutU1

Bytes PutU1( Bytes b,
             Integer startidx,
             Integer val,
             [Integer flags] )

Puts the given Integer into the Bytes as an unsigned, 4-byte value.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutU2

Bytes PutU2( Bytes b,
             Integer startidx,
             Integer val,
             [Integer flags] )

Puts the given Integer into the Bytes as an unsigned, 4-byte value.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

PutU4

Bytes PutU4( Bytes b,
             Integer startidx,
             Integer val,
             [Integer flags] )

Puts the given Integer into the Bytes as an unsigned, 4-byte value.

Parameters

b

The Bytes, or a copy of this Bytes, into which the value is put.

startidx

The index in the Bytes of where to put the value.

val

The value to put.

flags

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.

Returns:

The Bytes into which the value was put, which will be a copy of b unless Bytes.InPlace was specified as a flag.

ToBase64

String ToBase64( Bytes b )

Converts a byte array into a base64 encoded string.

Parameters

b

The Bytes to be converted.

Returns:

a string converted from the input Byte array.

 Copyright © 2022 OpenText Corporation. All rights reserved.