Siebel eScript Language Reference > Methods Reference > Buffer Methods >

Create Buffer Method


The Create Buffer method extracts the data that exists between two positions in a buffer. It returns this data in a new buffer object. This method does the following:

  • If the value that the beginning argument contains is less than 0, then it treats this value as 0, which is the beginning of the buffer.
  • If the value that the end argument contains is beyond the end of the buffer, then it uses null bytes to increase the size of the new buffer. It does not modify the source buffer. It duplicates the values of the unicode argument and the bigEndian argument in the new buffer.
  • Sets the length of the new buffer to the value that the end argument contains minus the value that the beginning argument contains.
Format

bufferVar.subBuffer(beginning, end)

Table 53 describes the arguments for the Create Buffer method.

Table 53. Arguments for the Create Buffer Method
Argument
Description

beginning

The position in the source buffer where this method begins to extract data.

end

The position in the source buffer where this method stops extracting data.

How the Create Buffer Method Sets the Cursor

Table 54 describes how the Create Buffer method sets the cursor.

Table 54. How the Create Buffer Method Sets the Cursor
Original Cursor Position
How the Create Buffer Method Sets the Cursor

Between the value that the beginning argument contains and the value that the end argument contains.

Sets the cursor position to a new relative position in the new buffer.

Before the value that the beginning argument contains.

Sets the cursor position to 0 in the new buffer.

After the value that the end argument contains.

Sets the cursor position to the end of the new buffer.

Example

The following example creates a new buffer named language and displays the contents of this buffer in a string named Siebel eScript. The Siebel eScript text begins in the nineteenth position:

var loveIt= new Buffer("I love coding with Siebel eScript!");
var language = loveIt.subBuffer(19, (loveIt.size - 1))
TheApplication().RaiseErrorText(language);

Related Topics

For more information, see Get String From Buffer Method.

Siebel eScript Language Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.