%Stream.FileCharacter
stream class %Stream.FileCharacter extends %Stream.FileBinary
For information on this class, see Working with Streams.
Stream class that stores character data in files. For example, the following code opens a file binary stream, points it at a particular file on the filesystem, and then reads it in chunks of 32,000 bytes:Set stream=##class(%Stream.FileCharacter).%New() Set sc=stream.LinkToFile("c:\myfile.txt") While 'stream.AtEnd { Set line=stream.Read() ; Process the chunk here }
Property Inventory
Method Inventory
Parameters
parameter OPENAPPEND = AWS;
parameter OPENREAD = RU;
parameter OPENREADTERM = RS;
parameter OPENWRITE = WSN;
Properties
property BOM as %String [ Transient ];
BOM characters that appear at start of file to signify which encoding it is using
Property methods: BOMDisplayToLogical(), BOMGet(), BOMIsValid(), BOMLogicalToDisplay(), BOMLogicalToOdbc(), BOMNormalize(), BOMSet()
property StreamFormatWrite as %Boolean [ InitialExpression = 1 , Transient ];
The StreamFormatWrite property controls whether file output is in stream or undefined format.
If StreamFormatWrite is 1 (true), the default, the file is written in S (stream) format.
If StreamFormatWrite is 0 (false), the file is written in U (Undefined) format.
For Unix file output, S format converts crlf to lf which can be a problem for MIME
output such as email. The user can now set messagepart.TextData.StreamFormatWrite=0
to keep crlf in text message parts of the mail message.
Property methods: StreamFormatWriteDisplayToLogical(), StreamFormatWriteGet(), StreamFormatWriteIsValid(), StreamFormatWriteLogicalToDisplay(), StreamFormatWriteNormalize(), StreamFormatWriteSet()
property TranslateTable as %String [ InitialExpression = "0" , Transient ];
The translation table to be used when reading or writing the file.
See Translation Tables.
Initial value of 0 indicates that the table has not yet been set.
If the translation table is set after the file has been opened then switch the table used for the file. If the translation table is set to "", then the "RAW" table is used.
Initial value of 0 indicates that the table has not yet been set.
If the translation table is set after the file has been opened then switch the table used for the file. If the translation table is set to "", then the "RAW" table is used.
Property methods: TranslateTableDisplayToLogical(), TranslateTableGet(), TranslateTableIsValid(), TranslateTableLogicalToDisplay(), TranslateTableLogicalToOdbc(), TranslateTableNormalize()
Methods
method %IsModified() as %Integer
Inherited description: 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 %ObjectModified() as %Integer
Inherited description: 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 %Oid() as %ObjectIdentity
Returns the OID of this object.
method IsFileUnicode() as %Boolean
Returns true if the file is Unicode.
This method may only be called after data has been read
from the file stream.
method SizeGet() as %Integer
Return the current size of the data stream.
Note this is complicated by having to worry about the translate table used to write the file.
If translation table is set after the file has been opened
then switch the table used for the file.
If the translation table is set to "", then the "RAW" table is used.
Inherited Members
Inherited Properties
- %Location
- AtEnd
- CanonicalFilename
- Filename
- Id
- LastModified
- LineTerminator
- ReadSize
- RemoveOnClose
- Size
Inherited Methods
- %AddToSaveSet()
- %CheckUnique()
- %ClassIsLatestVersion()
- %ClassName()
- %ConstructClone()
- %Delete()
- %DeleteExtent()
- %DeleteId()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Exists()
- %ExistsId()
- %Extends()
- %GetParameter()
- %GetSwizzleObject()
- %Id()
- %IsA()
- %IsNull()
- %KillExtent()
- %LOBPrefetch()
- %LocationSet()
- %LockStream()
- %New()
- %NormalizeObject()
- %ObjectIsNull()
- %ObjectSize()
- %Open()
- %OpenId()
- %OriginalNamespace()
- %PackageName()
- %ReleaseLock()
- %Reload()
- %RemoveFromSaveSet()
- %RollBack()
- %Save()
- %SerializeObject()
- %SetModified()
- %UnlockStream()
- %ValidateObject()
- CanonicalFilenameGet()
- Clear()
- CopyFrom()
- CopyFromAndSave()
- DefaultStreamDir()
- FileBinarySize()
- FilenameGet()
- FilenameSet()
- FindAt()
- Flush()
- GetStreamId()
- IdSet()
- InputFromDevice()
- IsCharacter()
- IsNull()
- LastModifiedGet()
- LineTerminatorSet()
- LinkToFile()
- MoveTo()
- MoveToEnd()
- NewFileName()
- OutputToDevice()
- OutputToDeviceAt()
- Read()
- ReadLine()
- ReadLineIntoStream()
- ReadSQL()
- Rewind()
- SerializeToSyncSet()
- StreamOIDIsNull()
- SyncStreamIn()
- Write()
- WriteLine()