Class: Wx::InputStream
- Inherits:
-
StreamBase
- Object
- StreamBase
- Wx::InputStream
- Defined in:
- lib/wx/doc/gen/fs_file.rb,
lib/wx/doc/stream.rb
Overview
This class is untracked and should not be derived from nor instances extended!
InputStream is an abstract base class which may not be used directly.
It is the base class of all streams which provide a #read function, i.e. which can be used to read data from a source (e.g. a file, a socket, etc). If you want to create your own input stream, you’ll need to derive from this class and implement the protected on_sys_read function only.
Category: Streams
Instance Method Summary collapse
-
#can_read ⇒ Boolean
(also: #can_read?)
Returns true if some data is available in the stream right now, so that calling #read wouldn’t block.
-
#eof ⇒ Boolean
Returns true after an attempt has been made to read past the end of the stream.
-
#get_c ⇒ Integer
(also: #c)
Returns the first character in the input queue and removes it, blocking until it appears if necessary.
-
#initialize ⇒ Wx::InputStream
constructor
Creates a dummy input stream.
-
#last_read ⇒ Integer
Returns the last number of bytes read.
-
#peek ⇒ Integer
Returns the first character in the input queue without removing it.
-
#read(stream_out) ⇒ Wx::InputStream
Reads data from the input queue and stores it in the specified output stream.
-
#read_all(size) ⇒ Object
Reads size bytes from stream (until eof or error).
-
#seek_i(pos, mode = Wx::SeekMode::FromStart) ⇒ Integer
Changes the stream current position.
-
#tell_i ⇒ Integer
Returns the current stream position or InvalidOffset if it’s not available (e.g.
-
#ungetch(c) ⇒ Boolean
This function acts like the previous one except that it takes only one character: it is sometimes shorter to use than the generic function.
Methods inherited from StreamBase
#get_last_error, #get_length, #get_size, #is_ok, #is_seekable, #reset
Constructor Details
#initialize ⇒ Wx::InputStream
Creates a dummy input stream.
227 |
# File 'lib/wx/doc/gen/fs_file.rb', line 227 def initialize; end |
Instance Method Details
#can_read ⇒ Boolean Also known as: can_read?
Returns true if some data is available in the stream right now, so that calling #read wouldn’t block.
231 |
# File 'lib/wx/doc/gen/fs_file.rb', line 231 def can_read; end |
#eof ⇒ Boolean
Returns true after an attempt has been made to read past the end of the stream.
236 |
# File 'lib/wx/doc/gen/fs_file.rb', line 236 def eof; end |
#get_c ⇒ Integer Also known as: c
Returns the first character in the input queue and removes it, blocking until it appears if necessary.
On success returns a value between 0 - 255; on end of file returns EOF.
242 |
# File 'lib/wx/doc/gen/fs_file.rb', line 242 def get_c; end |
#last_read ⇒ Integer
Returns the last number of bytes read.
247 |
# File 'lib/wx/doc/gen/fs_file.rb', line 247 def last_read; end |
#peek ⇒ Integer
Returns the first character in the input queue without removing it.
251 |
# File 'lib/wx/doc/gen/fs_file.rb', line 251 def peek; end |
#read(stream_out) ⇒ Wx::InputStream
Reads data from the input queue and stores it in the specified output stream.
The data is read until an error is raised by one of the two streams. This function returns a reference on the current object, so the user can test any states of the stream right away.
20 |
# File 'lib/wx/doc/stream.rb', line 20 def read(*args); end |
#read_all(size) ⇒ Object
Reads size bytes from stream (until eof or error). @param [Integer] size number of bytes to read @return [String,nil] string with bytes read (nil if none read)
25 |
# File 'lib/wx/doc/stream.rb', line 25 def read_all(size); end |
#seek_i(pos, mode = Wx::SeekMode::FromStart) ⇒ Integer
Changes the stream current position.
This operation in general is possible only for seekable streams (see StreamBase#is_seekable); non-seekable streams support only seeking positive amounts in mode SeekMode::FromCurrent (this is implemented by reading data and simply discarding it).
The new stream position or Wx::InvalidOffset on error.
269 |
# File 'lib/wx/doc/gen/fs_file.rb', line 269 def seek_i(pos, mode=Wx::SeekMode::FromStart) end |
#tell_i ⇒ Integer
Returns the current stream position or Wx::InvalidOffset if it’s not available (e.g.
socket streams do not have a size nor a current stream position).
275 |
# File 'lib/wx/doc/gen/fs_file.rb', line 275 def tell_i; end |
#ungetch(c) ⇒ Boolean
This function acts like the previous one except that it takes only one character: it is sometimes shorter to use than the generic function.
280 |
# File 'lib/wx/doc/gen/fs_file.rb', line 280 def ungetch(c) end |