Class: Bzip2::FFI::IO
- Inherits:
-
Object
- Object
- Bzip2::FFI::IO
- Defined in:
- lib/facter/util/bzip2-ffi-1.1.0/lib/bzip2/ffi/io.rb
Overview
Instance Method Summary collapse
-
#autoclose=(autoclose) ⇒ Object
Sets whether the underlying compressed IO-like instance should be closed when #close is called (‘true`) or left open (`false`).
-
#autoclose? ⇒ Boolean
Returns ‘true` if the underlying compressed IO-like instance will be closed when #close is called, otherwise `false`.
-
#binmode ⇒ IO
Puts the IO instance into binary mode.
-
#binmode? ⇒ Boolean
Returns ‘true` to indicate that the IO instance is operating in binary mode (as is always the case).
-
#close ⇒ NilClass
Closes the IO instance.
- #closed? ⇒ Boolean
-
#external_encoding ⇒ Encoding
Returns the ‘Encoding` object that represents the encoding of data prior to being compressed or after being decompressed.
-
#internal_encoding ⇒ Encoding
The internal encoding for character conversions.
Instance Method Details
#autoclose=(autoclose) ⇒ Object
Sets whether the underlying compressed IO-like instance should be closed when #close is called (‘true`) or left open (`false`).
109 110 111 112 |
# File 'lib/facter/util/bzip2-ffi-1.1.0/lib/bzip2/ffi/io.rb', line 109 def autoclose=(autoclose) check_closed @autoclose = !!autoclose end |
#autoclose? ⇒ Boolean
Returns ‘true` if the underlying compressed IO-like instance will be closed when #close is called, otherwise `false`.
97 98 99 100 |
# File 'lib/facter/util/bzip2-ffi-1.1.0/lib/bzip2/ffi/io.rb', line 97 def autoclose? check_closed @autoclose end |
#binmode ⇒ IO
Puts the Bzip2::FFI::IO instance into binary mode.
Note that Bzip2::FFI::IO and subclasses always operate in binary mode, so calling ‘binmode` has no effect.
131 132 133 134 |
# File 'lib/facter/util/bzip2-ffi-1.1.0/lib/bzip2/ffi/io.rb', line 131 def binmode check_closed self end |
#binmode? ⇒ Boolean
Returns ‘true` to indicate that the Bzip2::FFI::IO instance is operating in binary mode (as is always the case).
119 120 121 122 |
# File 'lib/facter/util/bzip2-ffi-1.1.0/lib/bzip2/ffi/io.rb', line 119 def binmode? check_closed true end |
#close ⇒ NilClass
Closes the Bzip2::FFI::IO instance.
If #autoclose? is true and the underlying compressed IO-like instance responds to ‘close`, it will also be closed.
143 144 145 146 147 |
# File 'lib/facter/util/bzip2-ffi-1.1.0/lib/bzip2/ffi/io.rb', line 143 def close check_closed @io.close if autoclose? && @io.respond_to?(:close) @stream = nil end |
#closed? ⇒ Boolean
Indicates whether the Bzip2::FFI::IO instance has been closed by calling #close.
153 154 155 |
# File 'lib/facter/util/bzip2-ffi-1.1.0/lib/bzip2/ffi/io.rb', line 153 def closed? !@stream end |
#external_encoding ⇒ Encoding
Returns the ‘Encoding` object that represents the encoding of data prior to being compressed or after being decompressed.
No character conversion is performed, so ‘external_encoding` always returns `Encoding::ASCII_8BIT` (also known as `Encoding::BINARY`).
165 166 167 168 |
# File 'lib/facter/util/bzip2-ffi-1.1.0/lib/bzip2/ffi/io.rb', line 165 def external_encoding check_closed Encoding::ASCII_8BIT end |
#internal_encoding ⇒ Encoding
The internal encoding for character conversions.
No character conversion is performed, so ‘internal_encoding` always returns `Encoding::ASCII_8BIT` (also known as `Encoding::BINARY`).
177 178 179 180 |
# File 'lib/facter/util/bzip2-ffi-1.1.0/lib/bzip2/ffi/io.rb', line 177 def internal_encoding check_closed Encoding::ASCII_8BIT end |