Class: Gsf::Input
- Inherits:
-
Object
- Object
- Gsf::Input
- Defined in:
- lib/gsf/input.rb
Direct Known Subclasses
Infile, InputGZip, InputGio, InputHTTP, InputMemory, InputProxy, InputStdio, InputTextline
Class Method Summary collapse
-
.error_id ⇒ GLib::Quark
A utility quark to flag a #GError as being an input problem.
Instance Method Summary collapse
-
#container ⇒ Gsf::Infile
The container, optionally nil, in which this input lives.
-
#container=(container) ⇒ Gsf::Infile
The container, optionally nil, in which this input lives.
-
#copy(output) ⇒ Boolean
Copy the contents from input to output from their respective current positions.
-
#dump(dump_as_hex) ⇒ nil
Dumps input's contents to STDOUT, optionally in hex format.
-
#dup ⇒ Gsf::Input
Duplicates input leaving the new one at the same offset.
-
#eof ⇒ Boolean
Are we at the end of the file?.
-
#eof=(eof) ⇒ Boolean
true if the end of the file has been reached.
-
#eof? ⇒ Boolean
true if the end of the file has been reached.
-
#find_vba ⇒ Gsf::InfileMSVBA
A utility routine that attempts to find the VBA file withint a stream.
-
#initialize(filename) ⇒ Gsf::Input
constructor
A new Gsf::InputMemory.
-
#modtime ⇒ GLib::DateTime
The time the input was last updated.
-
#modtime=(modtime) ⇒ GLib::DateTime
The time the input was last updated.
- #modtime_from_stat=(st) ⇒ Boolean
-
#name ⇒ String
Name.
- #name=(name) ⇒ String
-
#name_from_filename=(filename) ⇒ Boolean
protected.
-
#position ⇒ Integer
The current position in the input.
-
#position=(position) ⇒ Integer
The current position in the input.
-
#read(size = nil) ⇒ Array<Integer>
Read at least num_bytes.
-
#read0(num_bytes, bytes_read) ⇒ Array<Integer>
Read num_bytes.
-
#read_raw ⇒ Array<Integer>
Read at least num_bytes.
-
#remaining ⇒ Integer
The number of bytes remaining in the file.
-
#remaining=(remaining) ⇒ Integer
The number of bytes remaining in the file.
-
#seek(offset, whence) ⇒ Boolean
Move the current location in the input stream.
-
#seek_emulate(pos) ⇒ Boolean
Emulate forward seeks by reading.
-
#sibling(name) ⇒ Gsf::Input
UNIMPLEMENTED BY ANY BACKEND and it is probably unnecessary.
-
#size ⇒ Integer
The total number of bytes in the file.
-
#size=(size) ⇒ Integer
The total number of bytes in the file.
-
#tell ⇒ Gsf::gsf_off_t
The current offset in the file.
-
#uncompress ⇒ Gsf::Input
This functions takes ownership of the incoming reference and yields a new one as its output.
Constructor Details
#initialize(filename) ⇒ Gsf::Input
Returns A new Gsf::InputMemory.
Class Method Details
.error_id ⇒ GLib::Quark
Returns A utility quark to flag a #GError as being an input problem.
Instance Method Details
#container ⇒ Gsf::Infile
The container, optionally nil, in which this input lives.
#container=(container) ⇒ Gsf::Infile
The container, optionally nil, in which this input lives.
#copy(output) ⇒ Boolean
Copy the contents from input to output from their respective current positions. So if you want to be sure to copy everything, make sure to call gsf_input_seek (input, 0, G_SEEK_SET) and gsf_output_seek (output, 0, G_SEEK_SET) first, if applicable.
#dump(dump_as_hex) ⇒ nil
Dumps input's contents to STDOUT, optionally in hex format.
#dup ⇒ Gsf::Input
Duplicates input leaving the new one at the same offset.
#eof ⇒ Boolean
Are we at the end of the file?
#eof=(eof) ⇒ Boolean
true if the end of the file has been reached.
#eof? ⇒ Boolean
true if the end of the file has been reached.
#find_vba ⇒ Gsf::InfileMSVBA
A utility routine that attempts to find the VBA file withint a stream.
#modtime ⇒ GLib::DateTime
The time the input was last updated. This represents the timestamp from the originating file or GsfInfile member. It is not supported by all derived classes.
#modtime=(modtime) ⇒ GLib::DateTime
The time the input was last updated. This represents the timestamp from the originating file or GsfInfile member. It is not supported by all derived classes.
#modtime_from_stat=(st) ⇒ Boolean
#name ⇒ String
Returns name.
#name=(name) ⇒ String
#name_from_filename=(filename) ⇒ Boolean
protected.
#position ⇒ Integer
The current position in the input.
#position=(position) ⇒ Integer
The current position in the input.
#read(size = nil) ⇒ Array<Integer>
Read at least num_bytes. Does not change the current position if there is an error. Will only read if the entire amount can be read. Invalidates the buffer associated with previous calls to gsf_input_read. an error or 0 bytes are requested.
20 21 22 23 24 |
# File 'lib/gsf/input.rb', line 20 def read(size=nil) size ||= remaining bytes = read_raw(size) bytes.pack("C*") end |
#read0(num_bytes, bytes_read) ⇒ Array<Integer>
Read num_bytes. Does not change the current position if there is an error. Will only read if the entire amount can be read. the data read.
#read_raw ⇒ Array<Integer>
Read at least num_bytes. Does not change the current position if there is an error. Will only read if the entire amount can be read. Invalidates the buffer associated with previous calls to gsf_input_read. an error or 0 bytes are requested.
|
|
# File 'lib/gsf/input.rb', line 19
|
#remaining ⇒ Integer
The number of bytes remaining in the file.
#remaining=(remaining) ⇒ Integer
The number of bytes remaining in the file.
#seek(offset, whence) ⇒ Boolean
Move the current location in the input stream.
#seek_emulate(pos) ⇒ Boolean
Emulate forward seeks by reading.
#sibling(name) ⇒ Gsf::Input
UNIMPLEMENTED BY ANY BACKEND and it is probably unnecessary. gsf_input_get_container provides enough power to do what is necessary.
Attempts to open a 'sibling' of input. The caller is responsible for managing the resulting object.
#size ⇒ Integer
The total number of bytes in the file.
#size=(size) ⇒ Integer
The total number of bytes in the file.
#tell ⇒ Gsf::gsf_off_t
Returns the current offset in the file.
#uncompress ⇒ Gsf::Input
This functions takes ownership of the incoming reference and yields a new one as its output. but uncompressed if the source was compressed.