Class: ZIMG::JPEG::ECS
Overview
Its length is unknown in advance, nor defined in the file. The only way to get its length is to either decode it or to fast-forward over it: just scan forward for a FF byte. If it’s a restart marker (followed by D0 - D7) or a data FF (followed by 00), continue.
Instance Attribute Summary
Attributes inherited from Chunk
Instance Method Summary collapse
- #export(*_args) ⇒ Object
-
#initialize(io) ⇒ ECS
constructor
rubocop:disable Lint/MissingSuper.
Methods inherited from Chunk
Methods inherited from Chunk
Constructor Details
#initialize(io) ⇒ ECS
rubocop:disable Lint/MissingSuper
305 306 307 308 309 310 311 312 |
# File 'lib/zimg/jpeg/chunks.rb', line 305 def initialize(io) # rubocop:disable Lint/MissingSuper @data = io.read if (pos = @data.index(/\xff[^\x00\xd0-\xd7]/)) io.seek(pos - @data.size, :CUR) # seek back @data = @data[0, pos] end @size = @data.size end |
Instance Method Details
#export(*_args) ⇒ Object
314 315 316 |
# File 'lib/zimg/jpeg/chunks.rb', line 314 def export *_args @data end |