Method: Origami::Stream#decode!
- Defined in:
- lib/origami/stream.rb
#decode! ⇒ Object
Uncompress the stream data.
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/origami/stream.rb', line 304 def decode! self.decrypt! if self.is_a?(Encryption::EncryptedStream) return if decoded? filters = self.filters if filters.empty? @data = @encoded_data.dup return end unless filters.all?{|filter| filter.is_a?(Name)} raise InvalidStreamObjectError, "Invalid Filter type parameter" end dparams = decode_params @data = @encoded_data.dup @data.freeze filters.each_with_index do |filter, layer| params = dparams[layer].is_a?(Dictionary) ? dparams[layer] : {} # Handle Crypt filters. if filter == :Crypt raise Filter::Error, "Crypt filter must be the first filter" unless layer.zero? # Skip the Crypt filter. next end begin @data = decode_data(@data, filter, params) rescue Filter::Error => error @data = error.decoded_data if error.decoded_data raise end end self end |