Table of Contents

OIL2 Class Standard.ReadBuffer


class Standard . ReadBuffer {
        int32   bufferLimit;
        string  bufferedData;
        int32   bytesInBuffer;
        oid     clientObj;
        any     delimeter;
        int32   eofEncountered;
        int32   requestedBytes;
        oid     requestor;
        oid     srcObj;
        int32   waitForLine;
} inherits from Object;

DESCRIPTION

The ReadBuffer class implements a powerful convenience class for handling either asynchronous input sources and or record-oriented streams.

METHODS


Standard.ReadBuffer:create

ReadBuffer:create(oid ioObj, int32 bfrLimit)

Method Description

The create method takes one mandatory argument, which is the object Id of the IOobject from which data should be obtained. An optional second argument, bfrLimit can be provided that specifies the maximum size of the input buffer. There are tradeoffs in performance and memory utilization that can be altered through this parameter, but most users will want to leave it unspecified. /p>

Note: an allomorphic-equivalent to IOobject that provides implementations for selectForRead and readBytes can be used for ioObj.


Standard.ReadBuffer:setDelimeter

ReadBuffer:setDelimeter(string delim)

Method Description

The setDelimeter method is used to work in record-oriented mode. The delim pattern marks the end of each logical record in the input stream and can be more than one byte in length (for example, a carriage return/line feed pair).

Return Value

This method does not return a value.


Standard.ReadBuffer:selectForRead

ReadBuffer:selectForRead(optional oid notifyClient)

Method Description

The selectForRead method is used to request notification when data or a complete logical record is available in the buffer. If the notifyClient is not specified, it will default to fromObject.

Return Value

This method does not return a value.


Standard.ReadBuffer:readBytes

ReadBuffer:readBytes(int32 desiredBytes)

Method Description

The readBytes method reads the specified number of bytes. If the desired amount of data is currently available, it is immediately returned; otherwise the request is queued until it can be satisfied.

Return Value

An end-of-file indication is returned as a nil value; otherwise, the requested number of bytes are returned as a string.


Standard.ReadBuffer:readLine

ReadBuffer:readLine()

Method Description

The readLine method is used when working in record-oriented mode. The end-of-line pattern should be specified using the setDelimeter method; however, if no delimeter was set, it will be forced to the newline character.

Return Value

If the requested record is currently available, it is immediately returned; otherwise the request is queued until it can be satisfied. An end-of-file indication is returned as a nil value.


Standard.ReadBuffer:getLength

ReadBuffer:getLength()

Method Description

Returns an integer that indicates the bytes currently in the buffer.


Standard.ReadBuffer:peekBufferContents

ReadBuffer:peekBufferContents()

Method Description

Returns a string that is a copy of the buffer's current contents. No data is removed from the buffer.


Standard.ReadBuffer:deleteInitialBytes

ReadBuffer:deleteInitialBytes(int32 bytes)

Method Description

Deletes an indicated number of bytes from the front of the buffer.

Return Value

An integer that indicates the number of bytes left in the buffer is returned.


Generated: Wed, 14 Mar 2012 02:52:21 EDT
Support Information