class TEXT_FILE_READ_WRITE
Summary
This class allows to read and write a named file on the disk. Note that opening a file in READ and WRITE mode is not a very common case and may lead to performance decrease compared to TEXT_FILE_READ and TEXT_FILE_WRITE performance. Such a file is both an INPUT_STREAM and an OUTPUT_STREAM.
Direct parents
Inherit list: FILE_STREAM, TERMINAL_INPUT_OUTPUT_STREAM
Insert list: STRING_HANDLER
Class invariant
Overview
Creation features
{ANY}
Features
{ANY}
{FILTER_INPUT_STREAM}
{FILTER_OUTPUT_STREAM}
{FILTER}
{}
{ANY}
  • path: STRING
    Not Void when connected to the corresponding file on the disk.
  • is_connected: BOOLEAN
    Is this file connected to some file of the operating system?
{}
{ANY}
{}
{STREAM_HANDLER}
{ANY}
{}
{RECYCLING_POOL}
  • recycle
    Do whatever needs to be done to free resources or recycle other objects when recycling this one
{}
  • dispose
    Action to be executed just before garbage collection reclaims an object.
{}
{ANY}
{ANY}
{ANY}
{FILTER_INPUT_STREAM}
{FILTER}
{ANY}
{}
Skipping separators:
{ANY}
To read one number at a time:
{ANY}
To read one line or one word at a time:
{ANY}
Other features:
{ANY}
{}
{ANY}
{ANY}
{ANY}
{}
{ABSTRACT_STRING}
{ANY}
To write a number:
{ANY}
Other features:
{ANY}
{}
{}
connect_to (new_path: ABSTRACT_STRING)
effective procedure
{ANY}
Open for reading and writing.
connect_for_appending_to (new_path: ABSTRACT_STRING)
effective procedure
{ANY}
Open for reading and writing.
disconnect
effective procedure
{ANY}
Try to disconnect the stream.
can_unread_character: BOOLEAN
effective function
{ANY}
end_of_input: BOOLEAN
effective function
{ANY}
end_of_input means the previous attempt in character reading failed because the end has been reached.
out_in_tagged_out_memory
effective procedure
{ANY}
Append terse printable representation of current object in tagged_out_memory.
filtered_last_character: CHARACTER
writable attribute
filtered_read_character
effective procedure
filtered_unread_character
effective procedure
filtered_read_line_in (str: STRING)
effective procedure
filtered_put_character (c: CHARACTER)
effective procedure
filtered_flush
effective procedure
filtered_descriptor: INTEGER_32
effective function
Find the descriptor of the terminal stream...
filtered_has_descriptor: BOOLEAN
is True
constant attribute
True if the underlying terminal stream has a descriptor
filtered_stream_pointer: POINTER
effective function
Find the pointer of the terminal stream...
filtered_has_stream_pointer: BOOLEAN
is True
constant attribute
True if the underlying terminal stream has a pointer
unread_character_flag: BOOLEAN
writable attribute
{}
stream: POINTER
writable attribute
{}
make
effective procedure
{}
The new created object is not connected.
text_file_read_write_open (a_path_pointer: POINTER): POINTER
{}
text_file_read_write_append (a_path_pointer: POINTER): POINTER
{}
io_fclose (a_stream_pointer: POINTER)
{}
io_feof (a_stream_pointer: POINTER): BOOLEAN
{}
path: STRING
writable attribute
{ANY}
Not Void when connected to the corresponding file on the disk.
is_connected: BOOLEAN
effective function
{ANY}
Is this file connected to some file of the operating system?
set_path (new_path: ABSTRACT_STRING)
effective procedure
{}
descriptor: INTEGER_32
effective function
{ANY}
Some OS-dependent descriptor.
has_descriptor: BOOLEAN
effective function
{ANY}
True if that stream can be associated to some OS-meaningful descriptor.
can_disconnect: BOOLEAN
deferred function
{ANY}
True if the stream can be safely disconnected (without data loss, etc.)
url: URL
frozen
effective function
{ANY}
The URL to this stream as resource
url_memory: URL
writable attribute
{}
new_url: URL
deferred function
{}
stream_pointer: POINTER
effective function
Some Back-end-dependent pointer (FILE* in C, InputStream or OutputStream in Java)
has_stream_pointer: BOOLEAN
effective function
True if that stream can be associated to some Back-end-meaningful stream pointer.
event_exception: EVENT_DESCRIPTOR
effective function
{ANY}
stream_exception: STREAM_EXCEPTION
writable attribute
{}
recycle
effective procedure
Do whatever needs to be done to free resources or recycle other objects when recycling this one
dispose
effective procedure
{}
Action to be executed just before garbage collection reclaims an object.
sequencer_descriptor (file: POINTER): INTEGER_32
{}
detach
effective procedure
{ANY}
Detach the input and the output
See also detach_input, detach_output.
is_filtered: BOOLEAN
effective function
{ANY}
Is one of the input or output streams filtered?
set_filter (a_filter: FILTER)
effective procedure
{ANY}
Don't use (use set_input_filter or set_output_filter)
can_read_character: BOOLEAN
is True
constant attribute
{ANY}
Note that this state is usually temporary.
can_read_line: BOOLEAN
is True
constant attribute
{ANY}
valid_last_character: BOOLEAN
effective function
{ANY}
read_character
effective procedure
{ANY}
If read_character fail, end_of_input is set.
read_line_in (buffer: STRING)
effective procedure
{ANY}
Same job as read_line but storage is directly done in buffer.
read_available_in (buffer: STRING, limit: INTEGER_32)
effective procedure
{ANY}
Same job as read_available but storage is directly done in buffer.
unread_character
effective procedure
{ANY}
last_character: CHARACTER
effective function
{ANY}
filtered_read_available_in (buffer: STRING, limit: INTEGER_32)
effective procedure
writable attribute
The filter that uses this stream as backend
event_can_read: EVENT_DESCRIPTOR
effective function
{ANY}
writable attribute
{}
skip_separators
effective procedure
{ANY}
Skip all separators (see is_separator of class CHARACTER) and make the first non-separator available in last_character.
skip_separators_using (separators: STRING)
effective procedure
{ANY}
Same job as skip_separators using the separators set.
skip_remainder_of_line
effective procedure
{ANY}
Skip all the remainder of the line including the end of line delimiter itself.
read_integer
effective procedure
{ANY}
Read an integer according to the Eiffel syntax.
last_integer: INTEGER_32
writable attribute
{ANY}
Last integer read using read_integer.
valid_last_integer: BOOLEAN
writable attribute
{ANY}
Was the last call to read_integer successful ?
last_real: REAL_64
writable attribute
{ANY}
Last real read with read_real.
valid_last_real: BOOLEAN
writable attribute
{ANY}
Was the last call to read_real successful ?
read_real
effective procedure
{ANY}
Read a REAL and make the result available in last_real.
last_string: STRING
once function
{ANY}
Access to the unique common buffer to get for example the result computed by read_line, read_word, newline, etc.
read_line
effective procedure
{ANY}
Read a complete line ended by '%N' or end_of_input.%
read_available (limit: INTEGER_32)
effective procedure
{ANY}
Read as many characters as possible, as long as the stream does not block and up to the given limit.
read_word
effective procedure
{ANY}
Read a word using is_separator of class CHARACTER.
newline
effective procedure
{ANY}
Consume input until newline ('%N') is found.
reach_and_skip (keyword: STRING)
effective procedure
{ANY}
Try to skip enough characters in order to reach the keyword which is skipped too.
read_word_using (separators: STRING)
effective procedure
{ANY}
Same job as read_word using separators.
read_tail_in (str: STRING)
effective procedure
{ANY}
Read all remaining character of the stream in str.
io_getc (stream: POINTER): INTEGER_32
{}
io_ungetc (byte: CHARACTER, stream: POINTER)
{}
io_fread (buf: NATIVE_ARRAY[CHARACTER], size: INTEGER_32, stream: POINTER): INTEGER_32
{}
return size read or 0 if end of input (-1 on error => exception ?)
{}
can_put_character (c: CHARACTER): BOOLEAN
effective function
{ANY}
put_character (c: CHARACTER)
effective procedure
{ANY}
flush
effective procedure
{ANY}
Flushes the pipe.
event_can_write: EVENT_DESCRIPTOR
effective function
{ANY}
writable attribute
{}
as_output_stream: OUTPUT_STREAM
effective function
{}
put_natively_stored_string (s: NATIVELY_STORED_STRING)
effective procedure
put_abstract_string (s: ABSTRACT_STRING)
effective procedure
put_string (s: ABSTRACT_STRING)
effective procedure
{ANY}
Output s to current output device.
put_unicode_string (unicode_string: UNICODE_STRING)
effective procedure
{ANY}
Output the UTF-8 encoding of the unicode_string.
put_line (s: ABSTRACT_STRING)
effective procedure
{ANY}
Output the string followed by a '%N'.
put_integer (i: INTEGER_64)
frozen
effective procedure
{ANY}
Output i to current output device.
put_integer_format (i: INTEGER_64, s: INTEGER_32)
frozen
effective procedure
{ANY}
Output i to current output device using at most s character.
put_natural_8 (n: NATURAL_8)
frozen
effective procedure
{ANY}
Output n to current output device.
put_natural_8_format (n: NATURAL_8, s: INTEGER_32)
frozen
effective procedure
{ANY}
Output n to current output device using at most s character.
put_natural_16 (n: NATURAL_16)
frozen
effective procedure
{ANY}
Output n to current output device.
put_natural_16_format (n: NATURAL_16, s: INTEGER_32)
frozen
effective procedure
{ANY}
Output n to current output device using at most s character.
put_natural_32 (n: NATURAL_32)
frozen
effective procedure
{ANY}
Output n to current output device.
put_natural_32_format (n: NATURAL_32, s: INTEGER_32)
frozen
effective procedure
{ANY}
Output n to current output device using at most s character.
put_natural_64 (n: NATURAL_64)
frozen
effective procedure
{ANY}
Output n to current output device.
put_natural_64_format (n: NATURAL_64, s: INTEGER_32)
frozen
effective procedure
{ANY}
Output n to current output device using at most s character.
put_real (r: REAL_64)
effective procedure
{ANY}
Output r to current output device.
put_real_format (r: REAL_64, f: INTEGER_32)
effective procedure
{ANY}
Output r with only f digit for the fractional part.
put_real_scientific (r: REAL_64, f: INTEGER_32)
effective procedure
{ANY}
Output r using the scientific notation with only f digit for the fractional part.
put_number (number: NUMBER)
effective procedure
{ANY}
Output the number.
put_boolean (b: BOOLEAN)
effective procedure
{ANY}
Output b to current output device according to the Eiffel format.
put_pointer (p: POINTER)
effective procedure
{ANY}
Output a viewable version of p.
put_new_line
effective procedure
{ANY}
Output a newline character.
put_spaces (nb: INTEGER_32)
effective procedure
{ANY}
Output nb spaces character.
append_file (file_name: STRING)
effective procedure
{ANY}
tmp_file_read: TEXT_FILE_READ
once function
{}
tmp_string: STRING
once function
{}
io_putc (byte: CHARACTER, stream: POINTER)
{}
io_fwrite (buf: NATIVE_ARRAY[CHARACTER], size: INTEGER_32, stream: POINTER): INTEGER_32
{}
io_flush (stream: POINTER)
{}