indexing
	description: "Any medium that can perform input and/or output"
	status: "See notice at end of class"
	date: "$Date$"
	revision: "$Revision$"

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 -- 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

feature -- Input

	read_character
			-- Read a new character.
			-- Make result available in last_character.
			-- Was declared in IO_MEDIUM as synonym of 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 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 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 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 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 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.
		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.
		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.
		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.
		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.
		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.
		require
			is_readable: readable

feature -- Output

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

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

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

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

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

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

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

	put_string (s: STRING)
			-- Write s to medium.
			-- Was declared in IO_MEDIUM as synonym of 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.
		require
			extendible: extendible

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

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

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

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

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

invariant

		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)

indexing
	library: "[
			EiffelBase: Library of reusable components for Eiffel.
	]"
	status: "[
			Copyright 1986-2001 Interactive Software Engineering (ISE).
			For ISE customers the original versions are an ISE product
			covered by the ISE Eiffel license and support agreements.
	]"
	license: "[
			EiffelBase may now be used by anyone as FREE SOFTWARE to
			develop any product, public-domain or commercial, without
			payment to ISE, under the terms of the ISE Free Eiffel Library
			License (IFELL) at http://eiffel.com/products/base/license.html.
	]"
	source: "[
			Interactive Software Engineering Inc.
			ISE Building
			360 Storke Road, Goleta, CA 93117 USA
			Telephone 805-685-1006, Fax 805-685-6869
			Electronic mail <info@eiffel.com>
			Customer support http://support.eiffel.com
	]"
	info: "[
			For latest info see award-winning pages: http://eiffel.com
	]"

end -- class IO_MEDIUM