Skip to main content

%IO.I.Stream

abstract class %IO.I.Stream extends %Library.RegisteredObject

Abstract base class of all streams The methods of this class work for both Byte and Character streams

Property Inventory

Method Inventory

Properties

property AtEnd as %Boolean [ InitialExpression = 1 , ReadOnly ];
Property methods: AtEndDisplayToLogical(), AtEndGet(), AtEndIsValid(), AtEndLogicalToDisplay(), AtEndNormalize()
property DefaultFlushOnWrite as %Boolean [ Calculated , ReadOnly ];
InputStream interface Does this class flush after writes by default?
Property methods: DefaultFlushOnWriteDisplayToLogical(), DefaultFlushOnWriteIsValid(), DefaultFlushOnWriteLogicalToDisplay(), DefaultFlushOnWriteNormalize()
property IsCharacter as %Boolean [ Calculated , ReadOnly ];
Property methods: IsCharacterDisplayToLogical(), IsCharacterIsValid(), IsCharacterLogicalToDisplay(), IsCharacterNormalize()
property IsOpen as %Boolean [ InitialExpression = 0 , ReadOnly ];
Property methods: IsOpenDisplayToLogical(), IsOpenGet(), IsOpenIsValid(), IsOpenLogicalToDisplay(), IsOpenNormalize()
property Name as %String (MAXLEN = 500, TRUNCATE = 1);
Property methods: NameDisplayToLogical(), NameGet(), NameIsValid(), NameLogicalToDisplay(), NameLogicalToOdbc(), NameNormalize(), NameSet()

Methods

method Close(Output pSC As %Status) as %Boolean
Close the current stream
method CopyFrom(pSource As %IO.I.Stream, ByRef pTimeout As %Numeric = -1, pFlush As %Boolean = ..DefaultFlushOnWrite, Output pSC As %Status) as %Integer
Copy all available data from pSource to the current stream buffer. If pFlush is True, ensure that all data are actually sent to the stream.
method CopyReplace(pDest As %IO.I.Stream, pMaxReadLen As %Integer, ByRef pTimeout As %Numeric, pIdleTimeout As %Numeric, pPrevBuf As %String, pFlush As %Boolean, pInsensitive As %Boolean, pRewind As %String, Output pSC As %Status, pSearchReplace...) as %Integer
Replace from the current stream the strings contained in a list of alternating search and replace target string arguments. Accepts a destination stream pDest into which the modified result will be written. If not supplied, pDest will be returned containing a newly created GlobalCharacter stream. Reads until a maximum number of characters pMaxReadLen has been read or until a timeout pTimeout has occurred, or until pIdleTimeout seconds have elapsed with no further data read.

Setting pInsensitive=1 means the search strings will match in a case-insensitive way.

If pPrevBuf is provided, it is prepended to any data read, and is included in the attempt to find matching search strings. Replaces from left to right and does not repeat and recurse. This means that once a substring is replaced the replacement result will not be searched or replaced again. Returns the total count of characters written to the destination stream If pRewind contains i the input stream will be rewound before copying If pRewind contains I the input stream will be rewound after copying If pRewind contains o the output stream will be rewound before copying If pRewind contains O the output stream will be rewound after copying If pRewind is 1 both streams will be rewound before and after copying. This is the default. If pRewind is empty or zero neither stream will be rewound before or after copying

method CopyReplaceArray(pDest As %IO.I.Stream, pMaxReadLen As %Integer = -1, ByRef pTimeout As %Numeric = -1, pIdleTimeout As %Numeric = 5, pPrevBuf As %String = "", pFlush As %Boolean = ..DefaultFlushOnWrite, pInsensitive As %Boolean = 0, pRewind As %String = 1, Output pSC As %Status, ByRef pSearchReplace=0) as %Integer
Replace from the current stream the strings contained in an array of alternating search and replace target string values called pSearchReplace. Accepts a destination stream pDest into which the modified result will be written. If not supplied, pDest will be returned containing a newly created GlobalCharacter stream. Reads until a maximum number of characters pMaxReadLen has been read or until a timeout pTimeout has occurred, or until pIdleTimeout seconds have elapsed with no further data read.

Setting pInsensitive=1 means the search strings will match in a case-insensitive way.

If pPrevBuf is provided, it is prepended to any data read, and is included in the attempt to find matching search strings. Replaces from left to right and does not repeat and recurse. This means that once a substring is replaced the replacement result will not be searched or replaced again. Returns the total count of characters written to the destination stream

method DefaultFlushOnWriteGet()
method Flush(Output pSC As %Status)
Ensure that any data already written to the stream buffer are actually sent to the stream.
method InputFromDevice(ByRef pTotal As %Integer = 0, ByRef pTimeout As %Integer = -1, ByRef pIdleTimeout As %Integer = 20, Output pStatus As %Status) as %Integer
method OutputToDevice(pLength As %Integer = -1, ByRef pTimeout As %Numeric = -1, Output pSC As %Status) as %Integer
Copy all available data from the current stream to the current system device.
abstract method Read(pMaxReadLen As %Integer = $$$MaxLocalLength, ByRef pTimeout As %Numeric = -1, Output pSC As %Status) as %String
Read until pMaxReadLen chars are gotten or pTimeout expires On return, if pTimeout is unchanged it means the full timeout period expired. If the timeout period expired and the returned string is shorter than pMaxReadLen, then AtEnd will be 1.
method ReadUntil(pMaxReadLen As %Integer, ByRef pTimeout As %Numeric, pIdleTimeout As %Numeric, pPrevBuf As %String, pInsensitive As %Boolean, Output pWhich As %Integer, Output pSC As %Status, pTarget...) as %String
Read until one of the Target strings is found or a timeout occurs.

Return any data read until pTimeout seconds have elapsed, or until pIdleTimeout seconds elapse with no further data read, or up until any of the optional pTarget strings is encountered.

If pTarget strings are provided the pWhich output argument will contain an integer indicating which of them was matched. A value of 0 in pWhich indicates that none was matched and therefore the timeout expired or an error occurred.

Setting pInsensitive=1 means the pTarget strings will match data received in a case-insensitive way against the pTargets strings.

If pPrevBuf is provided, it is prepended to any data read, and is included in the attempt to find a matching target string.

method ReadUntilArray(pMaxReadLen As %Integer, ByRef pTimeout As %Numeric = -1, pIdleTimeout As %Numeric = 5, pPrevBuf As %String = "", pInsensitive As %Boolean = 0, Output pWhich As %Integer, Output pSC As %Status, ByRef pTargets) as %String
Read until one of the Target strings is found or a timeout occurs.

Return any data read until pTimeout seconds have elapsed, or until pIdleTimeout seconds elapse with no further data read, or up until any of the optional pTargets strings is encountered.

If pTargets strings are provided the pWhich output argument will contain an integer indicating which of them was matched. A value of 0 in pWhich indicates that none was matched and therefore the timeout expired or an error occurred.

Setting pInsensitive=1 means the pTarget strings will match data received in a case-insensitive way against the pTargets strings.

If pPrevBuf is provided, it is prepended to any data read, and is included in the attempt to find a matching target string.

abstract method Write(pData As %String, pFlush As %Boolean, Output pSC As %Status)
Write pData to the stream buffer. If pFlush is True, ensure that the data are actually sent to the stream.

Inherited Members

Inherited Methods

FeedbackOpens in a new tab