fsfileinputstream
Description
Provides an interface to open a file in a file system for sequential reading.
Type Tags
None
Object Value
The value of an object of type fsfileinputstream is undefined and it is an error to attempt to get or to set it.
fsfileinputstream.new()
Description
Opens the specified file system file for reading and creates a new object.
Prototype
fsfileinputstream
.new
(
string
,
integer filename
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
filename | .nul | string | The name of the file to open. |
error | .nul | integer |
Specifies an object that is used to output any error code generated during the
execution of the method. This parameter must be an object, not an
integer value. If error is
not specified or is .nul then any error that
occurs during object creation will halt the program. If an error
object is specified and an error occurs during execution then the
error code is output into that object and the method returns
.nul .
|
Properties
Property | Type | Description |
---|---|---|
_ | type(*) | This property is provided for use by the user to attach any object of any type to the type in which this property is provided. |
__ | type(*) | This property is provided for use by the user to attach any object of any type to the type in which this property is provided. It has the additional feature of being marked with the resolve keyword, so that object resolution can continue down this property. |
endofdata | boolean |
Contains the value .false until reading has failed because
the end of the file has been found, at which point it is set to
.true .
|
filename | string | Contains the name of the file that is being read. |
type | type | Specifies the fsfileinputstream type object. |
Methods
getblob()
Description
Returns a blob containing bytes read from the file.
Prototype
fsfileinputstreamvar
.getblob
(
integer
)
length
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
length | 1 | integer |
The number of bytes to read from the file. If this value is
.nul then the result will also be
.nul . If the value is .inf ,
then bytes will be read until the end of the file.
|
getinteger()
Description
Returns an integer read from the file.
Prototype
fsfileinputstreamvar
.getinteger
(
integer
,
boolean length
,
boolean lbo
)
signed
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
length | 1 | integer |
The number of bytes to read from the file. If this value is
.nul then the result will also be
.nul . If the value is .inf ,
then bytes will be read until the end of the file and then
interpreted as a single integer value.
|
lbo | .true | boolean |
Indicates whether integers have been stored with the least significant byte
first (.true ) or with the most significant
byte first (.false ). If this value is
.nul or .inf then the
result will also be .nul .
|
signed | .false | boolean |
Indicates whether the bytes will be interpreted as a signed or unsigned
integer. If this value is either .nul or
.inf then the result will also be
.nul .
|
getstring()
Description
Returns a string containing characters read from the file. If the string is stopped by a terminator (see the 'terminator' parameter) then the terminating character is not included in the returned string.
Prototype
fsfileinputstreamvar
.getstring
(
integer
,
integer length
,
boolean charsize
,
string lbo
,
string terminator
)
terminatedby
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
length | 1 | integer |
The number of characters to read from the file. If this value is
.nul then the result will also be
.nul . If the value is .inf ,
then characters will be read to the end of the file, or until a
terminator is found (see the terminator
parameter).
|
charsize | 2 | integer |
The number of bytes per character, which must be greater than 0. If this value
is either .nul or .inf then
the result will be .nul .
|
lbo | .true | boolean |
Indicates whether characters have been stored with the least significant byte
first (.true ) or with the most significant
byte first (.false ). If this value is
.nul or .inf then the
result will be .nul .
|
terminator | "" | string |
A string made up of all the characters which can terminate the string being
read. As soon as any one character in the string of terminators
is read then reading stops and the string is returned. If this
value is .nul then no character will terminate
the reading. If it is .inf then the result
will be .nul .
|
terminatedby | .nul | string |
This parameter must be an object, not a string value such as a literal or
expression. If the reading of the string is terminated by finding
a character in the terminator string then
that character is returned in the
terminatedby object.
|