public function stream_truncate($size)
    {
        if ($this->fileHandle === null) {
            return false;
        }
        self::restore();
        $success = ftruncate($this->fileHandle, $size);
        self::register();
        return $success;
    }