public function stream_truncate($size)
    {
        if (!$this->handle) {
            return false;
        }
        self::restorePrev();
        $success = \ftruncate($this->handle, $size);
        self::register();
        return $success;
    }