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 Index

     o InPlace
    The flag constant indicating that Put operations should modify the passed Bytes instead of a returned copy.
     o 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 Index

     o Allocate( Integer size )
    Allocates a new Bytes of the given size.
     o GetBytes( Bytes b, Integer startidx, Integer len )
    Returns a subrange of the specified Bytes.
     o GetCString( Bytes b, Integer startidx, [Integer flags] )
    Returns a String stored in the Bytes as a null-terminated string.
     o GetI1( Bytes b, Integer startidx, [Integer flags] )
    Returns the Integer value of a signed byte in a Bytes.
     o GetI2( Bytes b, Integer startidx, [Integer flags] )
    Returns an Integer from a signed, 2-byte value in a Bytes.
     o GetI4( Bytes b, Integer startidx, [Integer flags] )
    Returns an Integer from a signed, 4-byte value in a Bytes.
     o GetLBytes( Bytes b, Integer startidx, [Integer flags] )
    Returns a subrange of Bytes from a Bytes as prepended by a signed length indication.
     o GetLString( Bytes b, Integer startidx, [Integer flags] )
    Returns a String from a Bytes as prepended by a signed length indication.
     o GetPBytes( Bytes b, Integer startidx, [Integer flags] )
    Returns a subrange of Bytes from a Bytes as prepended by an unsigned length indication.
     o GetPString( Bytes b, Integer startidx, [Integer flags] )
    Returns a String from a Bytes as prepended by an unsigned length indication (a Pascal String).
     o GetPoint( Bytes b, Integer startidx, [Integer flags] )
    Returns a Point from a Bytes.
     o GetR4( Bytes b, Integer startidx, [Integer flags] )
    Returns a Real from a 4-byte value in a Bytes.
     o GetR8( Bytes b, Integer startidx, [Integer flags] )
    Returns a Real from a 8-byte value in a Bytes.
     o GetString( Bytes b, Integer startidx, [Integer maxlen], [Integer flags] )
    Returns a String extracted from the Bytes at the given index.
     o GetU1( Bytes b, Integer startidx, [Integer flags] )
    Returns an Integer from a single byte unsigned value in a Bytes.
     o GetU2( Bytes b, Integer startidx, [Integer flags] )
    Returns an Integer from a 2-byte unsigned value in a Bytes.
     o GetU4( Bytes b, Integer startidx, [Integer flags] )
    Returns an Integer from a 4-byte unsigned value in a Bytes.
     o NewFromString( String s )
    Returns a new Bytes containing the given String.
     o PutBytes( Bytes b, Integer startidx, Bytes arg3, [Integer flags] )
    Puts the contents of a Bytes into a Bytes.
     o 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).
     o PutI1( Bytes b, Integer startidx, Integer val, [Integer flags] )
    Puts an Integer into a Bytes as a single byte signed value.
     o PutI2( Bytes b, Integer startidx, Integer val, [Integer flags] )
    Puts an Integer into a Bytes as a 2-byte signed value.
     o PutI4( Bytes b, Integer startidx, Integer val, [Integer flags] )
    Puts an Integer into a Bytes as a 4-byte signed value.
     o 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.
     o PutLString( Bytes b, Integer startidx, String val, [Integer flags] )
    Puts a String into a bytes, prepended by a 4-byte signed length indication.
     o 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.
     o 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).
     o PutPoint( Bytes b, Integer startidx, Point val, [Integer flags] )
    Puts a Point into a Bytes.
     o PutR4( Bytes b, Integer startidx, Real val, [Integer flags] )
    Puts a Real into a Bytes as a 4-byte value.
     o PutR8( Bytes b, Integer startidx, Real val, [Integer flags] )
    Puts a Real into a Bytes as an 8-byte value.
     o PutString( Bytes b, Integer startidx, String val, [Integer flags] )
    Puts a String into a Bytes.
     o PutU1( Bytes b, Integer startidx, Integer val, [Integer flags] )
    Puts an Integer into a Bytes as a single byte unsigned value.
     o PutU2( Bytes b, Integer startidx, Integer val, [Integer flags] )
    Puts an Integer into a Bytes as a 2-byte unsigned value.
     o PutU4( Bytes b, Integer startidx, Integer val, [Integer flags] )
    Puts an Integer into a Bytes as a 4-byte unsigned value.

    Class Attributes

     o InPlace
     Integer InPlace
    

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

     o Swap
     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

     o 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.

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

     o 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

    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]
     o 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.
     - 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.
     o 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.

    See Bytes.PutI1() for an example.

     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.

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

     o 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.
     o 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.

    See Bytes.PutLBytes() and Bytes.PutPBytes().

     o 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.
     o 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.

    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
     o 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.
     o 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.
     o 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.

    See Bytes.PutPBytes() and Bytes.PutBytes().

     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.