indexing
	description: "Any medium that can perform input and/or output"

deferred class interface
	IO_MEDIUM

feature -- Access

	name: STRING
			-- Medium name

	retrieved: ANY
			-- Retrieved object structure
			-- To access resulting object under correct type,
			-- use assignment attempt.
			-- Will raise an exception (code Retrieve_exception)
			-- if content is not a stored Eiffel structure.
		require
			exists: exists;
			is_open_read: is_open_read;
			support_storable: support_storable
		ensure
			result_exists: Result /= void
	
feature -- Status report

	exists: BOOLEAN
			-- Does medium exist?

	extendible: BOOLEAN
			-- May new items be added?

	handle: INTEGER
			-- Handle to medium
		require
			valid_handle: handle_available

	handle_available: BOOLEAN
			-- Is the handle available after class has been
			-- created?

	is_closed: BOOLEAN
			-- Is the I/O medium open

	is_executable: BOOLEAN
			-- Is medium executable?
		require
			handle_exists: exists

	is_open_read: BOOLEAN
			-- Is this medium opened for input

	is_open_write: BOOLEAN
			-- Is this medium opened for output

	is_plain_text: BOOLEAN
			-- Is file reserved for text (character sequences)?

	is_readable: BOOLEAN
			-- Is medium readable?
		require
			handle_exists: exists

	is_writable: BOOLEAN
			-- Is medium writable?
		require
			handle_exists: exists

	last_character: CHARACTER
			-- Last character read by read_character

	last_double: DOUBLE
			-- Last double read by read_double

	last_integer: INTEGER
			-- Last integer read by read_integer

	last_real: REAL
			-- Last real read by read_real

	last_string: STRING
			-- Last string read

	readable: BOOLEAN
			-- Is there a current item that may be read?
		require
			handle_exists: exists

	support_storable: BOOLEAN
			-- Can medium be used to store an Eiffel object?
	
feature -- Status setting

	close
			-- Close medium.
		require
			medium_is_open: not is_closed
	
feature -- Element change

	basic_store (object: ANY)
			-- Produce an external representation of the
			-- entire object structure reachable from object.
			-- Retrievable within current system only.
		require
			object_not_void: object /= void;
			exists: exists;
			is_open_write: is_open_write;
			support_storable: support_storable

	general_store (object: ANY)
			-- Produce an external representation of the
			-- entire object structure reachable from object.
			-- Retrievable from other systems for same platform
			-- (machine architecture).
		require
			object_not_void: object /= void;
			exists: exists;
			is_open_write: is_open_write;
			support_storable: support_storable

	independent_store (object: ANY)
			-- Produce an external representation of the
			-- entire object structure reachable from object.
			-- Retrievable from other systems for the same or other
			-- platform (machine architecture).
		require
			object_not_void: object /= void;
			exists: exists;
			is_open_write: is_open_write;
			support_storable: support_storable
	
feature -- Removal

	dispose
			-- Ensure this medium is closed when garbage collected.
	
feature -- Output

	new_line
			-- Write a new line character to medium
			-- Was declared in IO_MEDIUM as synonym of put_new_line and new_line.
		require
			extendible: extendible

	put_boolean (b: BOOLEAN)
			-- Write b to medium.
			-- Was declared in IO_MEDIUM as synonym of put_boolean and putbool.
		require
			extendible: extendible

	put_character (c: CHARACTER)
			-- Write c to medium.
			-- Was declared in IO_MEDIUM as synonym of put_character and putchar.
		require
			extendible: extendible

	put_double (d: DOUBLE)
			-- Write d to medium.
			-- Was declared in IO_MEDIUM as synonym of put_double and putdouble.
		require
			extendible: extendible

	put_integer (i: INTEGER)
			-- Write i to medium.
			-- Was declared in IO_MEDIUM as synonym of put_integer and putint.
		require
			extendible: extendible

	put_new_line
			-- Write a new line character to medium
			-- Was declared in IO_MEDIUM as synonym of put_new_line and new_line.
		require
			extendible: extendible

	put_real (r: REAL)
			-- Write r to medium.
			-- Was declared in IO_MEDIUM as synonym of put_real and putreal.
		require
			extendible: extendible

	put_string (s: STRING)
			-- Write s to medium.
			-- Was declared in IO_MEDIUM as synonym of put_string and putstring.
		require
			extendible: extendible;
			non_void: s /= void

	putbool (b: BOOLEAN)
			-- Write b to medium.
			-- Was declared in IO_MEDIUM as synonym of put_boolean and putbool.
		require
			extendible: extendible

	putchar (c: CHARACTER)
			-- Write c to medium.
			-- Was declared in IO_MEDIUM as synonym of put_character and putchar.
		require
			extendible: extendible

	putdouble (d: DOUBLE)
			-- Write d to medium.
			-- Was declared in IO_MEDIUM as synonym of put_double and putdouble.
		require
			extendible: extendible

	putint (i: INTEGER)
			-- Write i to medium.
			-- Was declared in IO_MEDIUM as synonym of put_integer and putint.
		require
			extendible: extendible

	putreal (r: REAL)
			-- Write r to medium.
			-- Was declared in IO_MEDIUM as synonym of put_real and putreal.
		require
			extendible: extendible

	putstring (s: STRING)
			-- Write s to medium.
			-- Was declared in IO_MEDIUM as synonym of put_string and putstring.
		require
			extendible: extendible;
			non_void: s /= void
	
feature -- Input

	read_character
			-- Read a new character.
			-- Make result available in last_character.
			-- Was declared in IO_MEDIUM as synonym of read_character and readchar.
		require
			is_readable: readable

	read_double
			-- Read a new double.
			-- Make result available in last_double.
			-- Was declared in IO_MEDIUM as synonym of read_double and readdouble.
		require
			is_readable: readable

	read_integer
			-- Read a new integer.
			-- Make result available in last_integer.
			-- Was declared in IO_MEDIUM as synonym of read_integer and readint.
		require
			is_readable: readable

	read_line
			-- Read characters until a new line or
			-- end of medium.
			-- Make result available in last_string.
			-- Was declared in IO_MEDIUM as synonym of read_line and readline.
		require
			is_readable: readable

	read_real
			-- Read a new real.
			-- Make result available in last_real.
			-- Was declared in IO_MEDIUM as synonym of read_real and readreal.
		require
			is_readable: readable

	read_stream (nb_char: INTEGER)
			-- Read a string of at most nb_char bound characters
			-- or until end of medium is encountered.
			-- Make result available in last_string.
			-- Was declared in IO_MEDIUM as synonym of read_stream and readstream.
		require
			is_readable: readable

	readchar
			-- Read a new character.
			-- Make result available in last_character.
			-- Was declared in IO_MEDIUM as synonym of read_character and readchar.
		require
			is_readable: readable

	readdouble
			-- Read a new double.
			-- Make result available in last_double.
			-- Was declared in IO_MEDIUM as synonym of read_double and readdouble.
		require
			is_readable: readable

	readint
			-- Read a new integer.
			-- Make result available in last_integer.
			-- Was declared in IO_MEDIUM as synonym of read_integer and readint.
		require
			is_readable: readable

	readline
			-- Read characters until a new line or
			-- end of medium.
			-- Make result available in last_string.
			-- Was declared in IO_MEDIUM as synonym of read_line and readline.
		require
			is_readable: readable

	readreal
			-- Read a new real.
			-- Make result available in last_real.
			-- Was declared in IO_MEDIUM as synonym of read_real and readreal.
		require
			is_readable: readable

	readstream (nb_char: INTEGER)
			-- Read a string of at most nb_char bound characters
			-- or until end of medium is encountered.
			-- Make result available in last_string.
			-- Was declared in IO_MEDIUM as synonym of read_stream and readstream.
		require
			is_readable: readable
	
feature -- Obsolete

	lastchar: CHARACTER
			-- Last character read by read_character

	lastdouble: DOUBLE
			-- Last double read by read_double

	lastint: INTEGER
			-- Last integer read by read_integer

	lastreal: REAL
			-- Last real read by read_real

	laststring: STRING
			-- Last string read
	
end -- class IO_MEDIUM