Siebel eScript Language Reference > Siebel eScript Commands > Buffer Objects in Siebel eScript >

The Buffer Constructor in Siebel eScript


To create a Buffer object, use one of the following syntax forms.

Syntax A

new Buffer([size] [, unicode] [, bigEndian]);

Parameter
Description

size

The size of the new buffer to be created

unicode

True if the buffer is to be created as a Unicode string, otherwise, false; default is false

bigEndian

True if the largest data values are stored in the most significant byte; false if the largest data values are stored in the least significant byte; default is true

Usage

If size is specified, then the new buffer is created with the specified size and filled with null bytes. If no size is specified, then the buffer is created with a size of 0, although it can be extended dynamically later.

The unicode parameter is an optional Boolean flag describing the initial state of the Unicode flag of the object. Similarly, bigEndian describes the initial state of the bigEndian parameter of the buffer.

Syntax B

new Buffer( string [, unicode] [, bigEndian] );

Usage

This syntax creates a new Buffer object from the string provided. If the string parameter is a Unicode string (if Unicode is enabled within the application), then the buffer is created as a Unicode string.

This behavior can be overridden by specifying true or false with the optional Boolean Unicode parameter. If this parameter is set to false, then the buffer is created as an ASCII string, regardless of whether the original string was in Unicode or not.

Similarly, specifying true makes sure that the buffer is created as a Unicode string. The size of the buffer is the length of the string (twice the length if it is Unicode). This constructor does not add a terminating null byte at the end of the string.

Syntax C

new Buffer(buffer [, unicode] [, bigEndian]);

Parameter
Description

buffer

The buffer object from which the new buffer is to be created

unicode

True if the buffer is to be created as a Unicode string, otherwise, false; default is the Unicode status of the underlying Siebel eScript engine

bigEndian

True if the largest data values are stored in the most significant byte; false if the largest data values are stored in the least significant byte; default is true

Usage

A line of code following this syntax creates a new buffer object from the buffer provided. The contents of the buffer are copied as-is into the new buffer object. The unicode and bigEndian parameters do not affect this conversion, although they do set the relevant flags for future use.

Syntax D

new Buffer(bufferobject);

Parameter
Description

bufferobject

The buffer object from which the new buffer is to be created

Usage

A line of code following this syntax creates a new Buffer object from another Buffer object. Everything is duplicated exactly from the other bufferObject, including the cursor location, size, and data.

Siebel eScript Language Reference