public function attach($resource){
        if(!is_resource($resource) || "stream" !== get_resource_type($resource)){
            throw new \InvalidArgumentException(
                "Argument must be of the type stream resource, " . gettype($resource) . " given."
            );
        }

        $this->resource = $resource;
    }