Class Reference
IRIS for UNIX 2019.2
InterSystems: The power behind what matters   
Documentation  Search
  [%SYS] >  [%Stream] >  [DynamicCharacter]
Private  Storage   

stream class %Stream.DynamicCharacter extends %Stream.Object

%Stream.DynamicCharacter character stream containing the textual value of an element of a %DynamicAbstractObject. It is particularly useful for holding the value of a %DynamicAbstractObject element with a textual value that would exceed the capacity of an ObjectScript string variable. A %Stream.DynamicCharacter object is readonly and it cannot be modified or saved. But it can be copied to any other %Stream class object that does support modification and saving.

The only way to create a %Stream.DynamicCharacter is by making a method call that looks like dao.%Get(key,default,"stream") where dao is n object reference to a subclass of %DynamicAbstractObject; and where key is the key name value of an element of a %DynamicObject or the index value of an element of a %DynamicArray.

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
2 6 31


Summary

Properties
%Location AtEnd Id LastModified LineTerminator
Position Size

Methods
%AddToSaveSet %CheckUnique %ClassIsLatestVersion %ClassName
%ConstructClone %Delete %DeleteExtent %DeleteId
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Exists
%ExistsId %Extends %GetParameter %GetSwizzleObject
%Id %IsA %IsModified %IsNull
%KillExtent %LOBPrefetch %LocationSet %LockStream
%New %NormalizeObject %ObjectIsNull %ObjectModified
%ObjectSize %Oid %Open %OpenId
%OriginalNamespace %PackageName %ReleaseLock %Reload
%RemoveFromSaveSet %RollBack %Save %SerializeObject
%SetModified %UnlockStream %ValidateObject Clear
CopyFrom CopyFromAndSave FindAt Flush
GetStreamId InputFromDevice IsCharacter IsNull
LastModifiedGet MoveTo MoveToEnd OutputToDevice
OutputToDeviceAt PositionGet Read ReadLine
ReadLineIntoStream ReadSQL Rewind SerializeToSyncSet
SizeGet StreamOIDIsNull SyncStreamIn Write
WriteLine

Subclasses
%Stream.DynamicBinary

Parameters

• parameter BUFLEN = 32000;
Default read length when buffering
• parameter READLEN = 32000;
Default length for a Read.

Properties

• property LineTerminator as %String(MAXLEN=10) [ InitialExpression = $char(13,10),Transient ];
The line terminator we use for this stream. It defaults to $CHAR(13,10), CR/LF. Maximum length is 10 characters.
• property Position as %Integer [ Calculated ];
Position is a read-only property containing the current character position of the %Stream.DynamicCharacter. The next Read() method call will start reading at this character position. Character position 1 is the position of the first character in the stream. When Position contains the value 1 then the first Read() (after creation of the stream or after execution of the Rewind() method) has not yet been executed. After the last character has been read then Position will again contain the value 1.
• property Size as %Integer [ Calculated ];
Size is a read-only property containing the current size of the %Stream.DynamicCharacter in characters

Methods

• method %IsModified() as %Integer
Returns true (1) if a property of this instance has been modified, otherwise false (0). A TRUE result does not necessarily mean that any property has actually been changed. If %IsModified() returns false then the object has not been modified. There are some situations where we simply cannot efficiently detect a change in value. In these cases we will set the modified status of the property.
• method %IsNull() as %Boolean
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. But a %Stream.DynamicCharacter is never NULL, even if it only contains the empty string.
• method %NormalizeObject() as %Status
Normalizes all of an object's property values by invoking the data type Normalize methods. Many data types may allow many different representations of the same value. Normalization converts a value to its cannonical, or normalized, form.
• method %ObjectModified() as %Integer
This method is somewhat similar to %IsModified but it also checks to see if swizzled references would cause the object to become modified should they be serialized. This works on the assumption that a reference to a persistent object will never be modified if the ID has already been assigned. For references to serial objects, a call to %ObjectModified indicates whether or not the serialized value is different. If the reference to a swizzled object is different from the initial object state then the $$$objModAll macro will already return true. Reference the Set code. Returns true (1) if this instance has been modified, otherwise false (0).
• method %ValidateObject(force As %Integer = 0) as %Status
This method validates an object. The %Save method of a persistent class calls it before filing any objects in the database. The %ValidateObject method of a referencing object can call it. You can also call it explicitly at any time.

%ValidateObject does the following:

  1. It tests if any required property values are missing.
  2. If the PROPERTYVALIDATION class parameter is set to ValidateOnSave, it validates each non-null property value by calling the property method IsValid on each literal property and the object's %ValidateObject method for object-valued properties.
  3. If present, it will call a user-supplied %OnValidateObject method.

If any of these tests fail, %ValidateObject immediately returns an error value. It is up to the caller of %ValidateObject to process the error value.

Returns a %Status value indicating success or failure.

• method Clear(permanent As %Boolean = 1) as %Status

Not supported. %Stream.DynamicCharacter is readonly.

• method CopyFrom(source As %Stream.Object) as %Status

Not supported. %Stream.DynamicCharacter is readonly.

• method Flush() as %Status
Flush any output in the stream not already saved.
• method IsNull() as %Boolean
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. But a %Stream.DynamicCharacter is never NULL, even if it only contains the empty string.
• method MoveTo(position As %Integer) as %Boolean
Move to this position in the stream. If this succeeds then return true, else return false.

MoveTo(1) is equivalent to a Rewind(). MoveTo(1) will always succeed and it will position the %Stream.DynamicCharacter at character position 1 even if the %Stream.DynamicCharacter contains no characters. Moving to position 1 (or earlier) will be at the first character of the stream; position 2 will be at the second character of the stream, etc.

• method MoveToEnd() as %Status

Not supported. %Stream.DynamicCharacter is readonly.

• 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. If len is omitted or set to -1 then the OutputToDevice method will write out the entire stream starting at the beginning and then rewind back to the beginning. If len>0 and we are unable to write len characters because we reach the end of the stream then we will stop writing and set the AtEnd property to 1. Otherwise, we will leave the stream positioned after the last character written to the device. If parameter len is passed by reference and if no error occurs then the number of characters actually written to the output device will be assigned to len. If zero characters are written because we are already positioned at the end of the stream then len will be assigned to -1. If an error occurs while writing the device then len will be assigned to -2, an error %Status value will be returned and the stream will rollback to its original position.
• method PositionGet() as %Integer
Implements Property Position which contains the current position within the data stream.
• method Read(ByRef len As %Integer = ..#READLEN, ByRef sc As %Status) as %String
Reads up to len characters from the current position in the stream. The current position is advanced by the number of characters 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 -1 and Read will return a null string (""). If no len is passed in, ie. 'Read()' then it is up to the Read implementation as to how much data to return. Some stream classes use this to optimize the amount of data returned to align this with the underlying storage of the stream.

You must call Rewind if you want to read a stream from the beginning again. Calling Read after Write implicitly ends the Write operation and rewinds to the start of the stream.

Returns a string up to len characters long. The byref argument sc will return a %Status if any error occurred during the read.

• method ReadLine(ByRef len As %Integer = ..#READLEN, ByRef sc As %Status, ByRef eol As %Boolean) as %String
Read a line from the stream. This will look for the line terminator in the stream and once it finds the terminator it will return the string minus the terminator character/s. If it reaches the end of the stream before it finds a terminator it will return the data it has so far, and if you specify a maximum size in len it will only read up to this number of characters. On exit len will contain the actual number of characters read. The byref argument sc will return a %Status if any error occured during the read and the byref argument eol is true if it found the line terminator and false otherwise. So for example you can read in a stream a line at a time and output the results to the current device with:
	While 'stream.AtEnd { Write stream.ReadLine(,.sc,.eol) If $$$ISERR(sc) { Write "ERROR" Quit } If eol { Write ! } }
• method ReadLineIntoStream(ByRef sc As %Status) as %Stream.Object
This reads from the stream until it finds the LineTerminator and returns a new %Stream.TmpCharacter stream containing the characters in the line. If the stream does not contain the line terminator then this can potentially be the entire stream.
• method Rewind() as %Status
Go back to the start of the stream.
• method SizeGet() as %Integer
Implements Property Size which contains the current size of the data stream.
• method Write(data As %String = "") as %Status

Not supported. %Stream.DynamicCharacter is readonly.

• method WriteLine(data As %String = "") as %Status

Not supported. %Stream.DynamicCharacter is readonly.



Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.