def encode!
            return if encoded?

            filters = self.filters
            dparams = decode_params

            @encoded_data = @data.dup
            (filters.length - 1).downto(0) do |layer|
                params = dparams[layer].is_a?(Dictionary) ? dparams[layer] : {}
                filter = filters[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

                @encoded_data = encode_data(@encoded_data, filter, params)
            end

            self.Length = @encoded_data.length

            self
        end
def encode!
            return if encoded?

            filters = self.filters
            dparams = decode_params

            @encoded_data = @data.dup
            (filters.length - 1).downto(0) do |layer|
                params = dparams[layer].is_a?(Dictionary) ? dparams[layer] : {}
                filter = filters[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

                @encoded_data = encode_data(@encoded_data, filter, params)
            end

            self.Length = @encoded_data.length

            self
        end
Compress the stream data.