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

abstract class %IO.I.Stream extends %RegisteredObject

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

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
5 15


Summary

Properties
AtEnd DefaultFlushOnWrite IsCharacter IsOpen
Name

Methods
%AddToSaveSet %ClassIsLatestVersion %ClassName %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IsA %IsModified %New
%NormalizeObject %ObjectModified %OriginalNamespace %PackageName
%RemoveFromSaveSet %SerializeObject %SetModified %ValidateObject
Close CopyFrom CopyReplace CopyReplaceArray
DefaultFlushOnWriteGet Flush InputFromDevice OutputToDevice
Read ReadUntil ReadUntilArray Write

Subclasses
%IO.I.ByteStream

Properties

• property AtEnd as %Boolean [ InitialExpression = 1,ReadOnly ];
• property DefaultFlushOnWrite as %Boolean [ Calculated,ReadOnly ];
InputStream interface Does this class flush after writes by default?
• property IsCharacter as %Boolean [ Calculated,ReadOnly ];
• property IsOpen as %Boolean [ InitialExpression = 0,ReadOnly ];
• property Name as %String(MAXLEN=500,TRUNCATE=1);

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()
This is a Get accessor method for the DefaultFlushOnWrite property.
• 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.


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