public function appendFilter(string $filtername, int $read_write, $params = null)
    {
        $res = @stream_filter_append($this->stream, $filtername, $read_write, $params);
        if (is_resource($res)) {
            $this->filters[$filtername][] = $res;
            return;
        }

        throw new Exception(sprintf('unable to locate filter `%s`', $filtername));
    }