Class: PDF::Reader::Filter::Flate
- Inherits:
-
Object
- Object
- PDF::Reader::Filter::Flate
- Defined in:
- lib/pdf/reader/filter/flate.rb
Overview
implementation of the Flate (zlib) stream filter
Constant Summary collapse
- ZLIB_AUTO_DETECT_ZLIB_OR_GZIP =
: Integer # Zlib::MAX_WBITS + 32
47
- ZLIB_RAW_DEFLATE =
: Integer # Zlib::MAX_WBITS * -1
-15 #: Integer # Zlib::MAX_WBITS * -1
Instance Method Summary collapse
-
#filter(data) ⇒ Object
Decode the specified data with the Zlib compression algorithm : (String) -> String.
-
#initialize(options = {}) ⇒ Flate
constructor
: (?Hash[untyped, untyped]) -> void.
Constructor Details
#initialize(options = {}) ⇒ Flate
: (?Hash[untyped, untyped]) -> void
17 18 19 |
# File 'lib/pdf/reader/filter/flate.rb', line 17 def initialize( = {}) @options = end |
Instance Method Details
#filter(data) ⇒ Object
Decode the specified data with the Zlib compression algorithm : (String) -> String
24 25 26 27 28 29 30 31 32 |
# File 'lib/pdf/reader/filter/flate.rb', line 24 def filter(data) deflated = zlib_inflate(data) || zlib_inflate(data[0, data.bytesize-1]) if deflated.nil? raise MalformedPDFError, "Error while inflating a compressed stream (no suitable inflation algorithm found)" end Depredict.new(@options).filter(deflated) end |