class interface BASE64_OUTPUT_STREAM
--
-- A base64 encoder. The underlying stream gets encoded in base64 via this filter.
--
creation
connect_to (a_stream: OUTPUT_STREAM)
-- Connect the filter to some underlying stream.
require
not is_connected;
a_stream.is_connected;
not a_stream.is_filtered
ensure
is_connected
feature(s) from STREAM
is_connected: BOOLEAN
-- True if the filter is connected to some underlying stream.
disconnect
-- Disconnect from the underlying stream.
require
is_connected
require else
is_connected
ensure
not is_connected;
stream = Void;
filter = Void
is_filtered: BOOLEAN
detach
ensure
not is_filtered
feature(s) from STREAM
set_filter (a_filter: FILTER_OUTPUT_STREAM)
require
a_filter /= Void
ensure
filter = a_filter
filter: FILTER_OUTPUT_STREAM
feature(s) from OUTPUT_STREAM
put_character (c: CHARACTER)
require
is_connected;
not is_filtered and then can_put_character(c)
flush
-- Flushes the pipe. If is_filtered, calls the filter's
-- flush instead.
require
is_connected
can_put_character (c: CHARACTER): BOOLEAN
feature(s) from OUTPUT_STREAM
filtered_put_character (c: CHARACTER)
require
is_connected;
can_put_character(c)
filtered_flush
require
is_connected
feature(s) from OUTPUT_STREAM
put_string (s: STRING)
-- Output s to current output device.
require
is_connected;
not is_filtered;
s /= Void
put_unicode_string (unicode_string: UNICODE_STRING)
-- Output the UTF-8 encoding of the unicode_string.
require
is_connected;
not is_filtered;
unicode_string /= Void
feature(s) from OUTPUT_STREAM
-- To write a number:
put_integer (i: INTEGER_64)
-- Output i to current output device.
require
is_connected;
not is_filtered
put_integer_format (i: INTEGER_64; s: INTEGER)
-- Output i to current output device using at most s character.
require
is_connected;
not is_filtered
put_real (r: REAL)
-- Output r to current output device.
require
is_connected;
not is_filtered
put_real_format (r: REAL; f: INTEGER)
-- Output r with only f digit for the fractionnal part.
-- Examples:
-- put_real(3.519,2) print "3.51".
require
is_connected;
not is_filtered;
f >= 0
put_double (d: DOUBLE)
-- Output d to current output device.
require
is_connected;
not is_filtered
put_double_format (d: DOUBLE; f: INTEGER)
-- Output d with only f digit for the fractionnal part.
-- Examples:
-- put_double(3.519,2) print "3.51".
require
is_connected;
not is_filtered;
f >= 0
put_number (number: NUMBER)
-- Output the number.
require
is_connected;
not is_filtered;
number /= Void
feature(s) from OUTPUT_STREAM
-- Other features:
put_boolean (b: BOOLEAN)
-- Output b to current output device according
-- to the Eiffel format.
require
is_connected;
not is_filtered
put_pointer (p: POINTER)
-- Output a viewable version of p.
require
is_connected;
not is_filtered
put_new_line
-- Output a newline character.
require
is_connected;
not is_filtered
put_spaces (nb: INTEGER)
-- Output nb spaces character.
require
is_connected;
not is_filtered;
nb >= 0
append_file (file_name: STRING)
require
is_connected;
not is_filtered;
file_exists(file_name)
feature(s) from OUTPUT_STREAM
io_putc (byte: CHARACTER; stream: POINTER)
io_fwrite (buf: NATIVE_ARRAY[CHARACTER]; size: INTEGER; stream: POINTER)
io_flush (stream_pointer: POINTER)
tmp_file_read: TEXT_FILE_READ
tmp_string: STRING
feature(s) from FILTER
connect_to (a_stream: OUTPUT_STREAM)
-- Connect the filter to some underlying stream.
require
not is_connected;
a_stream.is_connected;
not a_stream.is_filtered
ensure
is_connected
feature(s) from FILTER
stream: OUTPUT_STREAM
-- The underlying stream (i.e. the filtered one)
feature(s) from FILTER
do_detach
-- Used by the underlying stream to require not to be filtered anymore
feature(s) from BASE64_OUTPUT_STREAM
state: INTEGER
previous_character: CHARACTER
feature(s) from BASE64_OUTPUT_STREAM
alphabet: STRING
t2b (code: INTEGER): CHARACTER
require
code >= 0 and then code < 64
ensure
alphabet.has(Result)
invariant
stream /= Void implies stream.filter = Current;
end of BASE64_OUTPUT_STREAM