public function read($len = null)
    {
        if (!$this->getInitialized()) {
            $this->_initialize();
            $this->checkAttributes();
            $this->setInitialized(true);
        }

        $buffer = $this->in->read($len);

        if ($buffer === -1 || !function_exists($this->function)) {
            return -1;
        }

        $lines = explode("\n", $buffer);

        $filtered = array_map($this->function, $lines);

        $filtered_buffer = implode("\n", $filtered);

        return $filtered_buffer;
    }