Skip to main content

%IO.LibraryStream

Class %IO.LibraryStream Extends %Library.AbstractStream [ ClassType = "", System = 2 ]

Adapts %IO stream classes to provide a legacy %Library.AbstractStream interface

Properties

IOStream

Property IOStream As %IO.I.Stream;

The %IO.I.Stream that we are wrapping

AtEnd

Property AtEnd As %Boolean;

Size

Property Size As %Integer [ Calculated ];

LastModified

Property LastModified As %TimeStamp [ Calculated, ReadOnly ];

LineTerminator

Property LineTerminator As %String(MAXLEN = 10);

Methods

%OnNew

Method %OnNew(initvalue As %String) As %Status [ Private ]

AtEndGet

Method AtEndGet() As %Boolean [ CodeMode = expression ]

SizeGet

Method SizeGet() As %Integer [ CodeMode = expression ]

LastModifiedGet

Method LastModifiedGet() As %TimeStamp [ CodeMode = expression ]

LineTerminatorGet

Method LineTerminatorGet() As %String [ CodeMode = expression ]

LineTerminatorSet

Method LineTerminatorSet(terminator As %String) As %Status

Rewind

Method Rewind() As %Status

Flush

Method Flush() As %Status

Read

Method Read(ByRef len As %Integer = 32000, ByRef sc As %Status) As %RawString

ReadLine

Method ReadLine(ByRef len As %Integer = 32000, ByRef sc As %Status, ByRef eol As %Boolean) As %RawString

ReadLineIntoStream

Method ReadLineIntoStream(ByRef sc As %Status) As %Library.AbstractStream

Write

Method Write(data As %RawString) As %Status

WriteLine

Method WriteLine(data As %RawString = "") As %Status

Appends the string data along with a line terminator to the stream and advances the current stream position by the number of characters in data plus the line terminator.

Returns a %Status value indicating success or failure.

CopyFrom

Method CopyFrom(source As %Stream.Object) As %Status

Copy the contents of the given source %IO, %Library or %Stream stream to the wrappered %IO stream

Clear

Method Clear() As %Status

MoveToEnd

Method MoveToEnd() As %Status

MoveTo

Method MoveTo(position As %Integer) As %Boolean

FindAt

Method FindAt(position As %Integer, target As %RawString, ByRef tmpstr As %RawString) As %Integer

Find the first occurrence of target in the stream starting the search at position. It returns the position at this match starting at the beginning of the stream. If it does not find the target string then return -1. If position=-1 then start searching from the current location and just return the offset from the last search, useful for searching through the entire file. If you are doing this you should pass in tmpstr by reference in every call which is used as a temporary location to store information being read so the next call will start where the last one left off.

OutputToDevice

Method OutputToDevice(ByRef len As %Integer = -1) As %Status

Write out len characters of the stream to the current device starting from the current position. This method is optimised for performance by the various sub classes. If len is omitted or set to -1 then it will write out the entire stream starting at the beginning.

InputFromDevice

Method InputFromDevice(ByRef len As %Integer = 0, timeout As %Integer = 20) As %Status

Input len characters from the current device into the stream. This is equivalent to doing a series of reads and calling Write for each of them but it may be optimised by the subclasses. On return len will be the number of characters still to read in (if no timeout has occured this should be 0).

OutputToDeviceAt

Method OutputToDeviceAt(position As %Integer, ByRef length As %Integer) As %Status

Output the stream to the current device starting at position of length length. The length if passed by reference returns the number of characters output.

CopyFromAndSave

Method CopyFromAndSave(source As %Stream.Object) As %Status