Properties | |
Stream object has no properties. | |
Methods | |
Stream object has no public constructors so it is impossible to create it using new operator. To create streams use static open*** methods. |
|
openFile |
(file-name [,mode]) → stream | null Static method. Opens the file which name is stored in the file-name string and returns an instance of Stream object. Operations allowed to the stream returned are defined by the mode parameter-string. Script engine uses C/C++ runtime for opening file streams. See fopen function definition for the meaning of the mode string. |
openSocket |
(address:port [, timeout ] ) → stream | null Static method. 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. Address can be either domain name or IP address. Format of address:port string is "domain:NNN" or "NNN.NNN.NNN.NNN:NNN" where N is a decimal digit. timeout is a number of seconds to wait on any operations on this socket. If execution of operation on this socket will take more than this limit then exception will be thrown by runtime system. Example: following code will print out http server response of terrainformatica.com server:
|
openString |
([initialSize:int | initialValue:string]) : stream
Static method. Opens in-memory string output stream with initialSize (integer) of its buffer. Use string streams when you plan to update some string frequently or compose string from many components. String streams are also known as StringBuffer/StringBuilder in Java or .NET. To get current content of the string stream use its method toString. |
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. |
close |
( ) → true | false Closes this stream - file, socket, string stream buffer. |
( string ) → true | false
Outputs string into the stream. print is an equivalent of: stream << string; operation. |
|
println |
( string ) → true | false
Outputs string appended by \r\n into the stream. |
printf |
Prints formatted text by the rules of printf C/C++ function. Additional format types:
|
putc |
( char-code ) → true | false
Outputs character into the stream. Character defined by its integer code. putc is an equivalent of: stream << charcode; operation. |
getc |
( ) → integer | undefined
Reads one character from the stream. Returns its code as integer or undefined if stream was closed or got EOF. |
readln |
( ) → string | undefined
Reads sequence of characters from stream until '\n' character. Returns string read without trailing '\r' and '\n'. |