FileContent¶
Represents the contents of a file. You can obtain an instance of this class using VolumeFile:READALL.
Internally this class stores raw data (a byte array). It can be passed around as is, for example this will copy a file:
SET CONTENTS TO OPEN("filename"):READALL.
SET NEWFILE TO CREATE("newfile").
NEWFILE:WRITE(CONTENTS).
You can parse the contents to read them as a string:
SET CONTENTS_AS_STRING TO OPEN("filename"):READALL:STRING.
// do something with a string:
PRINT CONTENTS_AS_STRING:CONTAINS("test").
Instances of this class can be iterated over. In each iteration step a single line of the file will be read.
-
structure
FileContent¶ Members¶ Suffix Type Description LENGTHscalar File length (in bytes) EMPTYboolean True if the file is empty TYPEStringType of the content STRINGStringContents of the file decoded using UTF-8 encoding ITERATORIteratorIterates over the lines of a file
Note
This type is serializable.
-
FileContent:
TYPE¶ Access: Get only Type: StringType of the content as a string. Can be one of the following:
- TOOSHORT
- Content too short to establish a type
- ASCII
- A file containing ASCII text, like the result of a LOG command.
- KSM
- A type of file containing KerboMachineLanguage compiled code, that was created from the COMPILE command.
- BINARY
- Any other type of file.