Home Index classes Index static functions Index enumerations Index structure types

{Stream|_base_class}


CLASS {Stream|_base_class} , ABSTRACT, BYTES, BITWISE, UNTESTED :


Base class for all {Stream} descendants ({File_stream}, {Memory_stream}, ...)


IMPORT : {String_functions} .


---------------------------------------------------------- 'size, position'

 

METHOD Size|_of_stream_dummy ==> {Long_int}.{long}


Size of the stream, in bytes. Still it can be large when the maximal integer possible, the REAL value is returning to represent the size.


METHOD Position|_in_stream_dummy ==> {long}


Current position in the stream in bytes, also as a real value.


METHOD Set_pos|ition (
     
{long} New|_position_dummy ,
     
{disp} Disp|osition_from_dummy )


Changing current position in the stream. The Disposition parameter specifies a point from which new position is calculated. So, New position value can be even negative, for example.


METHOD Rewind|_to_beginning



ENUMERATION {disp|osition_from} :

        'BEGINNING|_POSITION' ,

        'CURRENT|_POSITION' ,

        'ENDING|_POSITION' .


Possible three dispositions to set new Position value from.


METHOD Ended|_stream || EOF || EndOfFile ==> BOOL


Returns TRUE if the stream was ended while reading it (or its Position became equal or greater then its Size).


----------------------------------------------------------------- 'closing'


METHOD Close|_stream


Closing the stream. Call this method if you do not plan do any operations with the stream. If the stream object is destroying in result of releasing all the hard references onto the oject, it is first closed anyway.


METHOD Closed|_stream ==> BOOL


Returns TRUE for a closed stream object. Reading / writing is not possible for a closed stream (such requests are just ignoring).


-------------------------------------------------------- 'read/write bytes'

     

METHOD Load_bytes (
     
BYTE Dest|ination_dynamic [] ,
     
INT Count|_bytes_to_read_maximum ) ==> BOOL


Reading bytes to the buffer array Dest[] (which first is cleared). If reading was ok, TRUE is returned. Final size of the buffer can be less then the Count specified. The FALSE value is returned only in case when there were no bytes read.


METHOD Read_bytes ( BYTE Dest|ination [*] ) ==> INT


Reading bytes to the buffer fixed array Dest[], returning count of bytes read. This amount can be less then size of the buffer provided.


METHOD Read_byte ==> BYTE



METHOD Read_word ==> INT



METHOD Read_dword ==> INT



METHOD Save_bytes ( BYTE Source|_bytes [*] ) ==> INT


Writes bytes from the buffer fixed array Dest[], returns count bytes successfully written.


METHOD Write_byte ( BYTE B|yte_single )


Writes single byte B passed.


METHOD Write_int|eger_32bit (
     
INT Value|_4_bytes ) , DEPRECATED('Platform dependent')



METHOD Write_double (
     
REAL D|ouble_value|_8_bytes ) , DEPRECATED('Platform dependent')



------------------------------------------------------------- 'copy stream'


METHOD Copy_stream|_rest (
     
{Stream} Source|_stream ) , OPERATORS


Copying the rest of another stream (passed as a parameter) writing to the THIS stream object.


METHOD Copy_part_of_stream (
     
{Stream} Source|_stream ,
     
{long} Len|gth_bytes ) , OPERATORS


Copying a part of of another stream (passed as a parameter) writing it to the THIS stream object. Not more then Len bytes are copied.


------------------------------------------------------ 'read/write strings'

{String_functions}.{encoding} Encoding|_for_strings , READ



METHOD Set_encoding ( {encoding} Value|_encoding )


Setting an encoding for the stream object.


METHOD Detect_encoding|_call_only_at_the_start_of_reading_stream


Detects encoding of the stream which is a read stream using a BOM sequence at the start of data. It should be called only when the position is 0.


METHOD Get_string ( INT Len|gth_read_exactly ) ==> STR


Reading a string from the input stream of the length specified by the Len parameter (or shorter, if at the end of the stream).

BOOL Disable_auto_detect


 

METHOD Get_line ==> STR


Reading a string from the input stream (until the end of line characters, but ending line characters like #NL, #CR or #LF are not included in the RESULT).


METHOD Write|_as_is ( STR S|tring_to_write_as_is )



METHOD Write_string ( STR S|ource_string ) ==> BOOL


Writing a string to the stream. If it is necessary to write new line characters, add those at the end of the S parameter, or write these in a separate call. Or, use method Write_line.


METHOD Write_line ( STR S|ource_line ) ==> BOOL


Writing a string to the stream adding #NL characters.


------------------------------------------ 'write BOM (at position 0 only)'


METHOD Write_bom


Writing BOM bytes to the stream corresponding to the encoding set for then stream.

END