FOM Reference > Content > Tags > fStream interface
  
fStream interface
This object represents a text stream object, and contains all the properties and methods for directly manipulating its contents.
This object inherits from fTag.
StreamTransformFrequency enumeration
How often the transform should run.
The StreamTransformFrequency enumeration has the following constants of type int.
TRANSFORM_AUTO = 0
Run the transform automatically whenever the source changes.
TRANSFORM_AUTOSAVE = 1
Run the transform automatically, and save the results in the file.
TRANSFORM_MANUAL = 2
Run the transform once, but preserve the settings to enable it to be reactivated.
TRANSFORM_ONCE = 3
Run the transform once and discard the transform settings.
StreamTransformType enumeration
The type of transform to perform.
The StreamTransformType enumeration has the following constants of type int.
TRANSFORM_NONE = 0
No transform.
TRANSFORM_COPY = 1
Copy the source stream.
TRANSFORM_MAP = 2
Apply a character map to the source stream.
TRANSFORM_REPLACE = 3
Apply a set of search / replace actions to the source stream.
TRANSFORM_XSLT = 4
Apply an XSLT against the source stream.
TRANSFORM_XMLCOPY = 5
Serialize the XML tree associated with the source stream.
TRANSFORM_SAX = 7
Perform a SAX style parse on the source stream.
TRANSFORM_PERL = 8
Run a Perl Script against the source stream.
StreamSeekOrigin enumeration
The initial position to move from when using the fStream.seek method.
The StreamSeekOrigin enumeration has the following constants of type int.
SEEK_START = 0
Move from the start of the stream.
SEEK_CURRENT = 1
Move from the current position.
SEEK_END = 2
Move from the end of the stream.
MapReturnFlags enumeration
Flag values to specify how APP returns should be mapped while formatting.
The MapReturnFlags enumeration has the following constants of type int.
MAP_RETURNS = 1
Specifies that all the APP returns in a given text stream should be mapped to either a space or a 'yellow bar return' depending on the usege of the MAP_TO_YBR flag.
MAP_TO_YBR = 2
If return are being mapped, map them to a 'yellow bar return' rather than a space.
A yellow bar return (or spacer) is an APP-specific character that is used to space out code in the yellow edit bar. It is represented by APP-ISO character &147;.
MAP_CR_TO_RETURN = 4
If specified, this flag allows 'carriage returns' to be mapped to standard APP returns. Mapping of APP returns then applies.
IgnoreSpaceFlags enumeration
Flag values to specify which spaces should be ignored while formatting.
The IgnoreSpaceFlags enumeration has the following constants of type int.
IGNORE_START = 1
Specifies that the text stream should ignore spaces at the start of a paragraph
IGNORE_MULTIPLE = 2
Specifies that any multiple spaces in the text stream should be ignored.
IGNORE_END = 4
Specifies that the text stream should ignore spaces that appear at the end of a paragraph.
IGNORE_SPACES = 8
Specifies that all spaces in the text stream should be ignored.
IGNORE_NORMALIZE = 7
Specifies that spaces in the text stream should be normalized, i.e. start, end and multiple spaces should be ignored.
TagSelectionFlags enumeration
Flag values to specify which methods for selecting tags during formatting should be disabled.
The TagSelectionFlags enumeration has the following constants of type int.
DISABLE_NONE = 0
Allow APP to use all available methods for selecting tags.
DISABLE_APP = 1
Disable standard APP rules for selecting tags, such as tags with the exact name, or default tags.
DISABLE_CONTEXTS = 2
Disable context matching for this stream, regardless of whether a control stream is set or not.
DISABLE_ALL = 255
Disable all methods for selecting tags, apart from PIs.
articleThreading attribute
Macro: ttart
Enable article threading in this stream.
articleThreading
Access
read-write
Returns
boolean
augmentationCtrl attribute
Specifies the context control object containing the augmentation rules to use when formatting this stream.
augmentationCtrl
Access
read-write
Returns
fContexts
contextsCtrl attribute
Specifies the context control object to use when formatting this stream.
contextsCtrl
Access
read-write
Returns
fContexts
control attribute
The control object representation of this stream if it is of a valid type.
control
Access
read-only
Returns
fControl
currentPos attribute
If this is a text stream, the current position in the stream represented as the number of characters from the start. Otherwise, this property is 0.
currentPos
Access
read-write
Returns
int
defaultStyle attribute
The values in this style object will be applied when the stream is being formatted, before the contents of the stream are processed.
defaultStyle
Access
read-only
Returns
fStyle
disableTagSelection attribute
How to select tags whilst formatting this stream. If this value is 0, all current methods will be used, for example normal APP tag rules and contexts if specified. See fStream-TagSelectionFlags for possible values.
disableTagSelection
Access
read-write
Returns
int
flags attribute
The current stream flags.
flags
Access
read-write
Returns
int
ignoreSpaces attribute
Macro: ttignsp
Macro: ttignssp
Macro: ttignesp
Macro: ttignmsp
Specify which spaces should be ignored, see IgnoreSpaceFlags.
ignoreSpaces
Access
read-write
Returns
int
isEncrypted attribute
If true, the tag is encrypted and protected from reading.
isEncrypted
Access
read-only
Returns
boolean
isXML attribute
Macro: ttxml
If true, the contents of the stream will be parsed automatically and the resulting XML tree will be made available.
isXML
Access
read-write
Returns
boolean
mapReturns attribute
Macro: ttmapret
Macro: ttmaprety
Specify whether carriage returns should be mapped and what they're mapped to, see MapReturnFlags.
mapReturns
Access
read-write
Returns
int
mapTabs attribute
Macro: ttmaptab
If true, any tabs inthe text stream will be mapped to spaces.
mapTabs
Access
read-write
Returns
boolean
onEnter attribute
Specify a stream that is to be run immediately before each time this stream is entered.
onEnter
Access
read-write
Returns
fStream
onExit attribute
Specify a stream that is to be run immediately after each time this stream is left.
onExit
Access
read-write
Returns
fStream
pdfTag attribute
Specifies the name of the PDF Tag to create for this stream.
pdfTag
Access
read-write
Returns
String
pdfTagStream attribute
Specifies the PDF Tag Control Stream to obtain the settings from for the specified PDFTag.
If not specified, the default control stream will be used.
pdfTagStream
Access
read-write
Returns
fStream
recordRevMarks attribute
Macro: ttchange
If true, revision marks will be recorded, marking any changes, inserts, or deletions made in this stream.
recordRevMarks
Access
read-write
Returns
boolean
recordUndo attribute
Macro: ttundo
If true, any changes made to this stream will be recorded with the undo history.
recordUndo
Access
read-write
Returns
boolean
revMarksOverride attribute
Macro: ttchgsty
If true, revision marks will always be recorded for this stream, overriding any other setting.
revMarksOverride
Access
read-write
Returns
boolean
size attribute
The number of characters in this text stream.
size
Access
read-only
Returns
int
stripspaceCtrl attribute
Specifies the name of the Stripspace Control Stream to use with this stream.
stripspaceCtrl
Access
read-write
Returns
String
transformCtrl attribute
Macro: txform
Specifies the control stream to use in the transformation.
transformCtrl
Access
read-write
Returns
fStream
transformFrequency attribute
Macro: txform
Specifies how often to run the transformation. The possible values for this property are in fStream.StreamTransformFrequency.
transformFrequency
Access
read-write
Returns
int
transformParams attribute
Macro: txform
Specifies the parameter control stream to use in the transformation, if required.
transformParams
Access
read-write
Returns
fStream
transformSource attribute
Macro: txform
Specifies the input stream to use in the transformation.
transformSource
Access
read-write
Returns
fStream
transformType attribute
Macro: txform
Specifies which transformation is responsible for generating the contents of this stream. The possible values for this property are in fStream.StreamTransformType.
transformType
Access
read-write
Returns
int
xmlBaseURI attribute
Macro: tsbaseuri
Specifies the base path to use when resolving relative filenames during the XML parse.
xmlBaseURI
Access
read-write
Returns
String
xmlCatalog attribute
Macro: txmlcatalog
Specifies the location of the XML Catalog file for use when the stream is being validated.
xmlCatalog
Access
read-write
Returns
String
xmlDocument attribute
The fxDocument object for the attached XML document.
xmlDocument
Access
read-write
Returns
Object
xmlErrorPosCurrent attribute
This contains the current position in the XML stream where the error was found.
xmlErrorPosCurrent
Access
read-only
Returns
int
xmlErrorPosLast attribute
This contains the last position in the XML stream where the content was still considered well-formed.
xmlErrorPosLast
Access
read-only
Returns
int
xmlLoadExternal attribute
Macro: txmlext
If true, any external files referenced during XML parsing will be linked into the template and loaded. Otherwise, the files will be accessed directly.
xmlLoadExternal
Access
read-write
Returns
boolean
xmlParseError attribute
Contains the error code as a result of the most recent XML parse. This will be 0 if the parse completed successfully.
xmlParseError
Access
read-only
Returns
int
xmlValidError attribute
Contains the error code as a result of the most recent XML validation. This will be 0 if the stream is valid.
xmlValidError
Access
read-only
Returns
int
xmlValidate attribute
Macro: txmlvalid
If true, the contents of this stream will be validated during XML parsing.
xmlValidate
Access
read-write
Returns
boolean
xsltTransformError attribute
This contains the error code from the most recent XSLT Transform that created this stream.
xsltTransformError
Access
read-only
Returns
int
clear method
Deletes the entire contents of the stream.
clear
Parameters
None
Returns
void. None
Throws
fContentException
TEMPLATE_READONLY: The template is read only and cannot be changed.
delete method
Deletes the specified number of characters from the current position.
deleteposition
Parameters
intposition
Number of characters to delete.
Returns
void. None
load method
Macro: tft *
Loads the contents of a file into this text stream, replacing the contents
loadfilenamelinkoptions
Parameters
fPathfilename
The name and path of the file to be imported.
booleanlink
If true, the file will be linked to the text stream. Otherwise, the content will just be loaded into it.
Stringoptions
The options for loading the text stream, taken from the tft macro. Defaults to exact copy ("1eutyj").
Returns
void. None
Throws
fContentException
TEMPLATE_READONLY: The template is read only and cannot be changed.
fApplicationException
FILE_READ_ERROR: An error occurred reading from the file.
parseXML method
Macro: ttagxml
Performs a manual XML parse of the contents, regardless of the isXML flag, and updates xmlDocument.
parseXML
Parameters
None
Returns
void. None
read method
Reads a specified number of characters from the stream, starting from the current position.
readnumChars
Parameters
intnumChars
The number of characters to read.
Returns
String. The content read from the stream. If the string is empty, the end of the stream has been reached.
readln method
Reads up to the end of the line from the stream, starting from the current position.
readlnfeatures
Parameters
booleanfeatures
If true, obey "#if FEATURE" when finding the next line.
Returns
String. The content read from the stream. If the string is empty, the end of the stream has been reached.
run method
Macro: trun
Runs the contents of the stream. Depending on the type of script, any parameters on the method may get passed into the script, and return values may get passed back. Any exceptions raised in the script that have not been handled will get thrown by this method.
run
Parameters
None
Returns
void. None
Throws
fContentException
INVALID_TYPE: The stream is not a valid script type.
save method
Macro: tsavetxt
Saves the contents of the stream to a file.
savefilenamestripTags
Parameters
fPathfilename
The name and path of the file to use.
booleanstripTags
If true, any tags or entity references will be removed while saving.
Returns
void. None
Throws
fApplicationException
FILE_WRITE_ERROR: An error occurred writing to the file.
seek method
Moves the current position to a specified location. The position will be moved as far as possible without overrunning the start or end of the stream.
seekpositionorigin
Parameters
intposition
Number of characters to move from the origin. This value can be negative.
intorigin
The initial position to move from. The possible values are in fStream.SeekOrigin.
Returns
void. None
transform method
Macro: txform
Sets up a transformation that will be responsible for creating the contents of this stream. If no parameters are provided, then the values of the transform properties will be used, allowing for manual transforms to occur.
transformtypefrequencysourcecontrolparameters
Parameters
inttype
Specifies which transformation is responsible for generating the contents of this stream. The possible values for this property are in fStream.StreamTransformType.
intfrequency
Specifies how often to run the transformation. The possible values for this property are in fStream.StreamTransformFrequency.
fStreamsource
Specifies the input stream to use in the transformation.
fStreamcontrol
Specifies the control stream to use in the transformation.
fStreamparameters
Specifies the parameter control stream to use in the transformation, if required.
Returns
void. None
Throws
fContentException
TEMPLATE_READONLY: The template is read only and cannot be changed.
write method
Writes content into the stream at the current position.
writetext
Parameters
Stringtext
The content to write into the stream.
Returns
void. None
Throws
fContentException
TEMPLATE_READONLY: The template is read only and cannot be changed.
writeEscaped method
Writes content into the stream at the current position, replacing angle brackets and ampersands with their entity equivalents.
writeEscapedtext
Parameters
Stringtext
The content to write into the stream.
Returns
void. None
Throws
fContentException
TEMPLATE_READONLY: The template is read only and cannot be changed.