Stream(native)
Stream class has no public constructor to creates new instance use Stream.openFile, Stream.openSocket or Stream.openString functions.
Properties
-
encoding : Integer
Gets or sets encoding used by the stream. For now it supports either "none" (raw byte stream) and "utf-8" encodings.
-
isInput : Boolean
Reports if this is an input stream or not.
-
name : String
Name of the stream - either file name or url where the data came from. Can be an empty string, e.g. for in memory streams.
Methods
-
$(str) : Boolean
Stringizer method, outputs content in brackets appended by \n into the stream.
-
$(string) : Boolean
Stringizer method, outputs content in brackets appended by \n into the stream.
-
close() : Boolean
Closes this stream - file, socket or string stream buffer.
-
getc() : Integer
Reads one character from the stream.
-
openFile(fileName [,mode]) : Stream
Opens the file which name is stored in the file-name string and returns an instance of Stream object.
-
openSocket(addressPort, timeout = 10, numberOfAttempts = 1) : Stream
Opens the socket stream which address and port is stored in the address-port string and returns an instance of Stream object. Opens socket stream in read-write mode.
-
openString(initialSize|initialValue) : Stream
Opens in-memory string output stream with initialSize (integer) of its buffer.
-
print(str) : Boolean
Outputs string into the stream. print is an equivalent of: stream << str; operation.
-
printf(format [, value1[, value2[, ...[, valueN]]]]) : Boolean
Prints formatted text by the rules of printf C/C++ function.
-
println(str) : Boolean
Outputs string appended by \n into the stream. println is an equivalent of: stream<
-
putc(charCode) : Boolean
Outputs character into the stream. Character defined by its integer code. putc is an equivalent of: stream << charcode; operation.
-
readln() : String
Reads sequence of characters from stream until '\n' character.
-
scanf(format) : Array
Scans the stream for values according to the rules of scanf C/C++ function with wildcard (like %[a-z] ) extensions.
-
toString() : Stream
Returns content of string buffer if this is a string stream or name/address of the stream if it was open as file or socket stream.