%Library.AbstractStream
Class %Library.AbstractStream Extends %Stream.Object [ Abstract, ClientDataType = CHARACTERSTREAM, MemberSuper = %Compiler.Type.StreamLegacy, System = 2 ]
Deprecated class, the base stream class is %Stream.Object. This is kept for legacy reasons.
A stream represents an arbitrary array of characters (or bytes) and a current position. The basic stream interface provides the ability to read data from a stream, write data to the stream, and rewind the current position to the beginning of the stream.
Within InterSystems IRIS streams are used to create large (greater than 32K) object attributes.
Parameters
MAXLEN
Parameter MAXLEN = 2147483647;
The maximum number of characters (or bytes) allowed in a stream.
PROPERTYVALIDATION
Parameter PROPERTYVALIDATION As INTEGER [ Constraint = "0,1,2", Flags = ENUM ] = 0;
Turns off property validation.
MAXLOCALSIZE
Parameter MAXLOCALSIZE = 32000;
READNODATA
Parameter READNODATA [ Final ] = 0;
READNOTCHANGED
Parameter READNOTCHANGED [ Final ] = 1;
READCHANGED
Parameter READCHANGED [ Final ] = 2;
WRITE
Parameter WRITE [ Final ] = 3;
Properties
Attributes
Property Attributes As %String [ MultiDimensional ];
An array of strings containing any attribute values associated with this stream.
Mode
Property Mode As %Integer [ InitialExpression = 0, Private ];
LineTerminator
Property LineTerminator As %String(MAXLEN = 10) [ InitialExpression = {$char(13,10)} ];
Type of line terminator we use for this stream, defaults to Cr/Lf. Maximum length is 10 characters. This is stored as an attribute of the stream called 'LineTerminator'.
Methods
GetAttribute
Method GetAttribute(name As %String, default As %String = "") As %String [ CodeMode = expression, Final ]
Retrieves the named attribute value
SetAttribute
Method SetAttribute(name As %String, value As %String) [ Final ]
Inserts an attribute variable by name into the collection
IsDefinedAttribute
Method IsDefinedAttribute(name As %String) As %Boolean [ CodeMode = expression, Final ]
Returns true if the named attribute variable exists in the collection, false otherwise
NextAttribute
Method NextAttribute(name As %String) As %String [ Final ]
Retrieves the next attribute variable name in the sequence, skip any '%' names
DeleteAttribute
Method DeleteAttribute(name As %String) As %Boolean [ Final ]
Removes this attribute variable from the collection. Returns true is it existed and false if it did not exist.
GetAttributeList
Method GetAttributeList() As %String
SetAttributeList
Method SetAttributeList(attr As %String)
CopyFrom
Method CopyFrom(source As %Stream.Object) As %Status
Copies the contents of source into this Stream.
For example, you can copy oldstream into a new stream: Set newstream=##class(%GlobalCharacterStream).%New() Do newstream.CopyFrom(oldstream)
Returns a %Status value indicating success or failure.
IOOnNew
Method IOOnNew(initval As %String = "") As %Status [ Private ]
Perform any initialization required by the StreamAdaptor. This is called by the containing stream's %OnNew method.
IOInit
Method IOInit() [ Private ]
Initialize member variable used by the StreamAdaptor. This This is called when the containing stream is opened via %SetSerial.
IOOnClose
Method IOOnClose() As %Status [ Private ]
Perform any clean up required by the StreamAdaptor. This is called by the containing stream's %OnClose method.
IORewind
Method IORewind() As %Status [ Private ]
IOFlush
Method IOFlush() As %Status [ Private ]
IOGetSize
Method IOGetSize() As %Integer [ Private ]
Return the current size of the data stream.
IOGetStreamId
Method IOGetStreamId() As %String [ Private ]
Return the id for a stream; that is, an identifier that can later be used to open the same stream.
IOOpenStream
Method IOOpenStream(sid As %String) As %Status [ Private ]
Open the stream identified by sid.
IOSaveStream
Method IOSaveStream() As %Status [ Private ]
Write the stream to storage.
IODeleteStream
ClassMethod IODeleteStream(sid As %String, concurrency As %Integer = 0) As %Status [ Private ]
Delete the storage for the stream identified by sid.
IOReadData
Method IOReadData(ByRef len As %Integer, ByRef sc As %Status) As %String [ Private ]
Reads up to len characters from the current position in the stream. The current position is advanced by the number of characers read. Upon exit, len is set to the actual number of characters read. If a read occurs when the stream position is at the end of the stream, len will be set to 0 and IOReadData will return a null string ("").
Returns a string up to len characters long.
IOWriteData
Method IOWriteData(data As %String) As %Status [ Private ]
Writes data to the stream at the current location.
IOMoveToEnd
Method IOMoveToEnd() As %Status [ Private ]
Move to the end of the stream and set ourselves to #WRITE mode so the next IOWriteData will append data to the stream.
%Load
Method %Load(sid As %String) As %Status [ CodeMode = call, Private ]
%DeleteData
ClassMethod %DeleteData(soid As %String, concurrency As %Integer) As %Status [ CodeMode = call, Private ]
%SaveData
Method %SaveData(ByRef sid As %String) As %Status [ Private ]
%OnNew
Method %OnNew(initval As %String = "") As %Status [ CodeMode = call, Private ]
%OnClose
Method %OnClose() As %Status [ CodeMode = call, Private ]
Rewind
Method Rewind() As %Status [ CodeMode = call ]
Flush
Method Flush() As %Status [ CodeMode = call ]
GetStreamId
Method GetStreamId() As %String
Returns an full id value (including class name) with which the Stream implementation has stored the stream.
OpenStream
Method OpenStream(sid As %String) As %Status [ CodeMode = call ]
IsNull
Method IsNull() As %Boolean [ CodeMode = call ]
Returns true if this is a "NULL" stream; that is, a stream which has never been written to and saved. This is used by the InterSystems IRIS ODBC server.
%IsNull
Method %IsNull() As %Boolean [ CodeMode = expression ]
Returns true if this is a "NULL" stream; that is, a stream which has never been written to and saved. This is used by the InterSystems IRIS ODBC server.
SaveStream
Method SaveStream() As %Status [ CodeMode = call ]
Deprecated method, use %Save instead. Saves the temporary copy of the stream data to a persistent location. Note that any locking or transaction handling must be done by the caller.
Returns a %Status value indicating success or failure.
DeleteStream
ClassMethod DeleteStream(oid As %ObjectIdentity, concurrency As %Integer = 0) As %Status [ CodeMode = generator ]
Deprecated method, use %Delete instead. Deletes the stored stream identified by oid. This will not remove the stream attributes of any saved streams, it will just remove the stream data. If you need to clear the attributes as well you will have to call Clear on the stream object.
%GetSerial
Method %GetSerial(force As %Integer = 0) As %String [ CodeMode = call, Private ]
%SetSerial
Method %SetSerial(serialized As %String) As %Status [ CodeMode = call, Private ]
%Id
Method %Id() As %String
Returns the persistent object Id, if there is one, of this object.
Returns a null string if there is no object Id.
%LoadData
Method %LoadData(serialized As %String) As %Status [ Private ]
SizeGet
Method SizeGet() As %Integer [ CodeMode = call ]
LineTerminatorSet
Method LineTerminatorSet(terminator As %String) As %Status
Read
Method Read(ByRef len As %Integer = 32656, ByRef sc As %Status) As %RawString [ CodeMode = call ]
ReadLine
Method ReadLine(ByRef len As %Integer = 32000, ByRef sc As %Status, ByRef eol As %Boolean) As %RawString
ReadLineIntoStream
Method ReadLineIntoStream() As %AbstractStream
This reads from the stream until it find the LineTerminator and returns this as a stream. If the stream does not contain the line terminator this can potentially be the entire stream.
Write
Method Write(data As %RawString = "") As %Status [ CodeMode = call ]
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.
MoveToEnd
Method MoveToEnd() As %Status [ CodeMode = call ]
%IsModified
Method %IsModified() As %Integer
%ObjectModified
Method %ObjectModified() As %Integer