note description: "Serialize/Deserialize data from a medium." legal: "See notice at end of class." status: "See notice at end of class." date: "$Date: 2017-09-25 15:53:33 +0000 (Mon, 25 Sep 2017) $" revision: "$Revision: 100789 $" class interface SED_MEDIUM_READER_WRITER create make (a_medium: IO_MEDIUM) -- Initialize current to read or write from a_medium. require a_medium_not_void: a_medium /= Void a_medium_support_storable: a_medium.support_storable ensure medium_set: medium = a_medium buffer_size_set: buffer_size = Default_buffer_size make_for_reading (a_medium: IO_MEDIUM) -- Initialize current to read from a_medium. require a_medium_not_void: a_medium /= Void a_medium_open_for_reading: a_medium.is_open_read a_medium_support_storable: a_medium.support_storable ensure medium_set: medium = a_medium buffer_size_set: buffer_size = Default_buffer_size make_for_writing (a_medium: IO_MEDIUM) -- Initialize current to write to a_medium. require a_medium_not_void: a_medium /= Void a_medium_open_for_writing: a_medium.is_open_write a_medium_support_storable: a_medium.support_storable ensure medium_set: medium = a_medium buffer_size_set: buffer_size = Default_buffer_size make_with_buffer (a_medium: IO_MEDIUM; a_buffer_size: INTEGER_32) -- Initialize current to read or write from a_medium using a buffer of size a_buffer_size. -- buffer_size will be overriden during read operation by the value of buffer_size used -- when writing. require a_medium_not_void: a_medium /= Void a_buffer_size_non_negative: a_buffer_size >= 0 a_medium_support_storable: a_medium.support_storable ensure medium_set: medium = a_medium buffer_size_set: buffer_size = a_buffer_size buffer_size_set: buffer.count = a_buffer_size feature -- Access generating_type: TYPE [detachable SED_MEDIUM_READER_WRITER] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) ensure -- from ANY generating_type_not_void: Result /= Void generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) ensure -- from ANY generator_not_void: Result /= Void generator_not_empty: not Result.is_empty read_boolean: BOOLEAN -- Read next boolean -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_character_32: CHARACTER_32 -- Read next 32-bits character -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_character_8: CHARACTER_8 -- Read next 8-bits character -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_compressed_integer_32: INTEGER_32 -- Read next compressed integer_32. -- See read_compressed_natural_32 for more details about encoding. -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_compressed_natural_32: NATURAL_32 -- Read next compressed natural_32. -- Depending on first natural_8 value read, it will tell how much more we need to read: -- 1 - Of the form 0xxxxxxx (0x00) for values between 0 and 127 -- 2 - Of the form 10xxxxxx (0x80) for values between 128 and 16382 and one more to read. -- 3 - Of the form 110xxxxx (0xC0) for values between 16383 and 2097150 and 2 more to read. -- 4 - Of the form 1110xxxx (0xE0) for values between 2097151 and 268435454 and 3 more to read -- 5 - Otherwise a full natural_32 to read. -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_immutable_string_32: IMMUTABLE_STRING_32 -- Read next sequence of characters encoded in UTF-8 as an IMMUTABLE_STRING_32. -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading ensure -- from SED_READER_WRITER read_string_8_not_void: Result /= Void read_immutable_string_8: IMMUTABLE_STRING_8 -- Read next 8-bits sequence of character as an IMMUTABLE_STRING_8 -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading ensure -- from SED_READER_WRITER read_immutable_string_8_not_void: Result /= Void read_integer_16: INTEGER_16 -- Read next integer_16 -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_integer_32: INTEGER_32 -- Read next integer_32 -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_integer_64: INTEGER_64 -- Read next integer_64 -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_integer_8: INTEGER_8 -- Read next integer_8 -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_natural_16: NATURAL_16 -- Read next natural_16 -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_natural_32: NATURAL_32 -- Read next natural_32 -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_natural_64: NATURAL_64 -- Read next natural_64 -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_natural_8: NATURAL_8 -- Read next natural_8 -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_pointer: POINTER -- Read next pointer -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_real_32: REAL_32 -- Read next real_32 -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_real_64: REAL_64 -- Read next real_64 -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_string_32: STRING_32 -- Read next sequence of characters encoded in UTF-8. -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading ensure -- from SED_READER_WRITER read_string_8_not_void: Result /= Void read_string_8: STRING_8 -- Read next 8-bits sequence of character -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading ensure -- from SED_READER_WRITER read_string_8_not_void: Result /= Void Reader_writer_version_6_6: NATURAL_32 = 1 -- Version of format used for reading/writing. feature -- Comparison frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void -- or attached to isomorphic object structures? -- (from ANY) ensure -- from ANY instance_free: class shallow_implies_deep: standard_equal (a, b) implies Result both_or_none_void: (a = Void) implies (Result = (b = Void)) same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b)) symmetric: Result implies deep_equal (b, a) frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached -- to objects considered equal? -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b)) frozen is_deep_equal alias "≡≡≡" (other: SED_MEDIUM_READER_WRITER): BOOLEAN -- Are Current and other attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY shallow_implies_deep: standard_is_equal (other) implies Result same_type: Result implies same_type (other) symmetric: Result implies other.is_deep_equal (Current) is_equal (other: SED_MEDIUM_READER_WRITER): BOOLEAN -- Is other attached to an object considered -- equal to current object? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b)) frozen standard_is_equal alias "≜" (other: SED_MEDIUM_READER_WRITER): BOOLEAN -- Is other attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) feature -- Status report cleanup -- When a reading is stopped, perform the necessary cleanup to perform -- another reading or writing. require -- from SED_READER_WRITER is_ready: is_ready_for_reading conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of other (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void is_for_reading: BOOLEAN -- Will current do a read operation? -- (from SED_BINARY_READER_WRITER) is_last_chunk: BOOLEAN -- Are we reading the last chunk? is_pointer_value_stored: BOOLEAN -- Is value of a POINTER stored? -- (from SED_READER_WRITER) is_ready_for_reading: BOOLEAN -- Is Current ready for future read operations? require -- from SED_READER_WRITER True is_ready_for_writing: BOOLEAN -- Is Current ready for future write operations? require -- from SED_READER_WRITER True same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of other? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) feature -- Element change write_boolean (v: BOOLEAN) -- Write v. -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_character_32 (v: CHARACTER_32) -- Write v. -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_character_8 (v: CHARACTER_8) -- Write v. -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_compressed_integer_32 (v: INTEGER_32) -- Write v as a compressed integer_32. -- See write_compressed_natural_32 for details about encoding. -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_compressed_natural_32 (v: NATURAL_32) -- Write v as a compressed natural_32. -- Depending on value of v, it will tell how many natural_8 will -- be written. Below here is the actual encoding where x represents -- a meaningful bit for v and the last number in parenthesis is the -- marker value in hexadecimal which is added to the value of v. -- 1 - For values between 0 and 127, write 0xxxxxxx (0x00). -- 2 - For values between 128 and 16382, write 0x10xxxxxx xxxxxxxx (0xE0). -- 3 - For values between 16383 and 2097150, write 0x110xxxxx xxxxxxxx xxxxxxxx (0xC0). -- 4 - For values between 2097151 and 268435454, write 0x1110xxx xxxxxxxx xxxxxxxx xxxxxxxx (0xE0). -- 5 - Otherwise write v as a full natural_32. -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_integer_16 (v: INTEGER_16) -- Write v. -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_integer_32 (v: INTEGER_32) -- Write v. -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_integer_64 (v: INTEGER_64) -- Write v. -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_integer_8 (v: INTEGER_8) -- Write v. -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_natural_16 (v: NATURAL_16) -- Write v. -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_natural_32 (v: NATURAL_32) -- Write v. -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_natural_64 (v: NATURAL_64) -- Write v. -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_natural_8 (v: NATURAL_8) -- Write v. -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_pointer (v: POINTER) -- Write v. -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_real_32 (v: REAL_32) -- Write v. -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_real_64 (v: REAL_64) -- Write v. -- (from SED_BINARY_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_string_32 (v: READABLE_STRING_GENERAL) -- Write v in UTF-8 format. -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing v_not_void: v /= Void write_string_8 (v: READABLE_STRING_8) -- Write v. -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_writing v_not_void: v /= Void feature -- Duplication copy (other: SED_MEDIUM_READER_WRITER) -- Update current object using fields of object attached -- to other, so as to yield equal objects. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: SED_MEDIUM_READER_WRITER) -- Effect equivalent to that of: -- copy (other . deep_twin) -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY deep_equal: deep_equal (Current, other) frozen deep_twin: SED_MEDIUM_READER_WRITER -- New object structure recursively duplicated from Current. -- (from ANY) ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) frozen standard_copy (other: SED_MEDIUM_READER_WRITER) -- Copy every field of other onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_standard_equal: standard_is_equal (other) frozen standard_twin: SED_MEDIUM_READER_WRITER -- New object field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) frozen twin: SED_MEDIUM_READER_WRITER -- New object equal to Current -- twin calls copy; to change copying/twinning semantics, redefine copy. -- (from ANY) ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current feature -- Basic operations frozen default: detachable SED_MEDIUM_READER_WRITER -- Default value of object's type -- (from ANY) frozen default_pointer: POINTER -- Default value of type POINTER -- (Avoid the need to write p.default for -- some p of type POINTER.) -- (from ANY) ensure -- from ANY instance_free: class default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) frozen do_nothing -- Execute a null action. -- (from ANY) ensure -- from ANY instance_free: class feature -- Access bits size boolean_bits: INTEGER_32 -- Number of bits in a value of type BOOLEAN -- (from PLATFORM) ensure -- from PLATFORM instance_free: class Character_32_bits: INTEGER_32 = 32 -- Number of bits in a value of type CHARACTER_32 -- (from PLATFORM) Character_8_bits: INTEGER_32 = 8 -- Number of bits in a value of type CHARACTER_8 -- (from PLATFORM) Integer_16_bits: INTEGER_32 = 16 -- Number of bits in a value of type INTEGER_16 -- (from PLATFORM) Integer_32_bits: INTEGER_32 = 32 -- Number of bits in a value of type INTEGER_32 -- (from PLATFORM) Integer_64_bits: INTEGER_32 = 64 -- Number of bits in a value of type INTEGER_64 -- (from PLATFORM) Integer_8_bits: INTEGER_32 = 8 -- Number of bits in a value of type INTEGER_8 -- (from PLATFORM) Natural_16_bits: INTEGER_32 = 16 -- Number of bits in a value of type NATURAL_16 -- (from PLATFORM) Natural_32_bits: INTEGER_32 = 32 -- Number of bits in a value of type NATURAL_32 -- (from PLATFORM) Natural_64_bits: INTEGER_32 = 64 -- Number of bits in a value of type NATURAL_64 -- (from PLATFORM) Natural_8_bits: INTEGER_32 = 8 -- Number of bits in a value of type NATURAL_8 -- (from PLATFORM) pointer_bits: INTEGER_32 -- Number of bits in a value of type POINTER -- (from PLATFORM) ensure -- from PLATFORM instance_free: class Real_32_bits: INTEGER_32 = 32 -- Number of bits in a value of type REAL_32 -- (from PLATFORM) Real_64_bits: INTEGER_32 = 64 -- Number of bits in a value of type REAL_64 -- (from PLATFORM) feature -- Access bytes size boolean_bytes: INTEGER_32 -- Number of bytes in a value of type BOOLEAN -- (from PLATFORM) ensure -- from PLATFORM instance_free: class Character_32_bytes: INTEGER_32 = 4 -- Number of bytes in a value of type CHARACTER_32 -- (from PLATFORM) Character_8_bytes: INTEGER_32 = 1 -- Number of bytes in a value of type CHARACTER_8 -- (from PLATFORM) Integer_16_bytes: INTEGER_32 = 2 -- Number of bytes in a value of type INTEGER_16 -- (from PLATFORM) Integer_32_bytes: INTEGER_32 = 4 -- Number of bytes in a value of type INTEGER_32 -- (from PLATFORM) Integer_64_bytes: INTEGER_32 = 8 -- Number of bytes in a value of type INTEGER_64 -- (from PLATFORM) Integer_8_bytes: INTEGER_32 = 1 -- Number of bytes in a value of type INTEGER_8 -- (from PLATFORM) Natural_16_bytes: INTEGER_32 = 2 -- Number of bytes in a value of type NATURAL_16 -- (from PLATFORM) Natural_32_bytes: INTEGER_32 = 4 -- Number of bytes in a value of type NATURAL_32 -- (from PLATFORM) Natural_64_bytes: INTEGER_32 = 8 -- Number of bytes in a value of type NATURAL_64 -- (from PLATFORM) Natural_8_bytes: INTEGER_32 = 1 -- Number of bytes in a value of type NATURAL_8 -- (from PLATFORM) pointer_bytes: INTEGER_32 -- Number of bytes in a value of type POINTER -- (from PLATFORM) ensure -- from PLATFORM instance_free: class Real_32_bytes: INTEGER_32 = 4 -- Number of bytes in a value of type REAL_32 -- (from PLATFORM) Real_64_bytes: INTEGER_32 = 8 -- Number of bytes in a value of type REAL_64 -- (from PLATFORM) feature -- Header/Footer read_footer -- Action being executed after finishing to read data. -- (from SED_READER_WRITER) require -- from SED_READER_WRITER is_ready: is_ready_for_reading read_header -- Retrieve configuration of how data was stored. require -- from SED_READER_WRITER is_ready: is_ready_for_reading write_chunk_header -- Store information about chunks write_footer -- Store last buffered data. require -- from SED_READER_WRITER is_ready: is_ready_for_writing write_header -- Store configuration on how data will be stored. require -- from SED_READER_WRITER is_ready: is_ready_for_writing feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) ensure -- from ANY instance_free: class io_not_void: Result /= Void out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY out_not_void: Result /= Void print (o: detachable ANY) -- Write terse external representation of o -- on standard output. -- (from ANY) ensure -- from ANY instance_free: class frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY tagged_out_not_void: Result /= Void feature -- Platform is_64_bits: BOOLEAN -- Is the current process runing in 64-bit mode -- (from PLATFORM) ensure -- from PLATFORM instance_free: class is_dotnet: BOOLEAN -- Are we targetting .NET? -- (from PLATFORM) ensure -- from PLATFORM instance_free: class Is_little_endian: BOOLEAN -- Is current platform a little endian one? -- (from PLATFORM) ensure -- from PLATFORM instance_free: class is_mac: BOOLEAN -- Are we running on Mac OS? -- (from PLATFORM) ensure -- from PLATFORM instance_free: class is_scoop_capable: BOOLEAN -- Is current platform capable of SCOOP? -- (from PLATFORM) ensure -- from PLATFORM instance_free: class is_thread_capable: BOOLEAN -- Is current platform capable of multi-threading? -- (from PLATFORM) ensure -- from PLATFORM instance_free: class is_unix: BOOLEAN -- Are we running on a Unix like platform? -- (from PLATFORM) ensure -- from PLATFORM instance_free: class is_vms: BOOLEAN -- Are we running on VMS? -- (from PLATFORM) ensure -- from PLATFORM instance_free: class is_vxworks: BOOLEAN -- Are we running on VxWorks? -- (from PLATFORM) ensure -- from PLATFORM instance_free: class is_windows: BOOLEAN -- Are we running on Windows platform? -- (from PLATFORM) ensure -- from PLATFORM instance_free: class Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) ensure -- from ANY instance_free: class operating_environment_not_void: Result /= Void feature -- Settings set_for_reading -- Set current for reading. -- (from SED_BINARY_READER_WRITER) ensure -- from SED_BINARY_READER_WRITER is_for_reading: is_for_reading set_for_writing -- Set current for writing. -- (from SED_BINARY_READER_WRITER) ensure -- from SED_BINARY_READER_WRITER is_for_writing: not is_for_reading set_is_pointer_value_stored (v: like is_pointer_value_stored) -- Set is_pointer_value_stored with v. -- (from SED_READER_WRITER) ensure -- from SED_READER_WRITER is_pointer_value_stored_set: is_pointer_value_stored = v invariant medium_not_void: medium /= Void -- from SED_BINARY_READER_WRITER buffer_not_void: buffer /= Void buffer_size_non_negative: buffer_size >= 0 buffer_position_non_negative: buffer_position >= 0 stored_pointer_bytes_non_negative: stored_pointer_bytes >= 0 -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) note library: "EiffelBase: Library of reusable components for Eiffel." copyright: "Copyright (c) 1984-2017, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class SED_MEDIUM_READER_WRITER
Generated by ISE EiffelStudio