Class: Omnizip::Algorithms::LZMA::LzipDecoder::TrackingInputStream
- Inherits:
-
Object
- Object
- Omnizip::Algorithms::LZMA::LzipDecoder::TrackingInputStream
- Defined in:
- lib/omnizip/algorithms/lzma/lzip_decoder.rb
Overview
Wrapper input stream that tracks bytes read
Instance Attribute Summary collapse
-
#bytes_read ⇒ Object
readonly
Returns the value of attribute bytes_read.
Instance Method Summary collapse
- #eof? ⇒ Boolean
- #getbyte ⇒ Object
-
#initialize(input, start_offset = 0) ⇒ TrackingInputStream
constructor
A new instance of TrackingInputStream.
- #read(size = nil) ⇒ Object
Constructor Details
#initialize(input, start_offset = 0) ⇒ TrackingInputStream
Returns a new instance of TrackingInputStream.
344 345 346 347 |
# File 'lib/omnizip/algorithms/lzma/lzip_decoder.rb', line 344 def initialize(input, start_offset = 0) @input = input @bytes_read = start_offset end |
Instance Attribute Details
#bytes_read ⇒ Object (readonly)
Returns the value of attribute bytes_read.
342 343 344 |
# File 'lib/omnizip/algorithms/lzma/lzip_decoder.rb', line 342 def bytes_read @bytes_read end |
Instance Method Details
#eof? ⇒ Boolean
361 362 363 |
# File 'lib/omnizip/algorithms/lzma/lzip_decoder.rb', line 361 def eof? @input.eof? end |
#getbyte ⇒ Object
355 356 357 358 359 |
# File 'lib/omnizip/algorithms/lzma/lzip_decoder.rb', line 355 def getbyte byte = @input.getbyte @bytes_read += 1 if byte byte end |
#read(size = nil) ⇒ Object
349 350 351 352 353 |
# File 'lib/omnizip/algorithms/lzma/lzip_decoder.rb', line 349 def read(size = nil) data = @input.read(size) @bytes_read += data.bytesize if data data end |