See {@link GoogleCloudStorage#open(StorageResourceId)} for details about expected behavior.
763625
@Override
  public SeekableByteChannel open(StorageResourceId resourceId)
      throws IOException {
    return open(resourceId, GoogleCloudStorageReadOptions.DEFAULT);
  }
761299
private void setNameSpaceID(File storage, String nsid)
      throws InconsistentFSStateException {
    if (nsid == null || nsid.equals("")) {
      throw new InconsistentFSStateException(storage, "file "
          + STORAGE_FILE_VERSION + " is invalid.");
    }
    int newNsId = Integer.parseInt(nsid);
    if (namespaceID > 0 && namespaceID != newNsId) {
      throw new InconsistentFSStateException(storage,
          "Unexepcted namespaceID " + nsid + " . Expected " + namespaceID);
    }
    namespaceID = newNsId;
  }
759883
public GVRAndroidResource openResource(String filePath) throws IOException {
        // Error tolerance: Remove initial '/' introduced by file::///filename
        // In this case, the path is interpreted as relative to defaultPath,
        // which is the root of the filesystem.
        if (filePath.startsWith(File.separator)) {
            filePath = filePath.substring(File.separator.length());
        }

        filePath = adaptFilePath(filePath);
        String path;
        int resourceId;

        GVRAndroidResource resourceKey;
        switch (volumeType) {
        case ANDROID_ASSETS:
            // Resolve '..' and '.'
            path = getFullPath(defaultPath, filePath);
            path = new File(path).getCanonicalPath();
            if (path.startsWith(File.separator)) {
                path = path.substring(1);
            }
            resourceKey = new GVRAndroidResource(gvrContext, path);
            break;

            case ANDROID_RESOURCE:
            path = FileNameUtils.getBaseName(filePath);
            resourceId = gvrContext.getContext().getResources().getIdentifier(path, "raw", gvrContext.getContext().getPackageName());
            if (resourceId == 0) {
                throw new FileNotFoundException(filePath + " resource not found");
            }
            resourceKey = new GVRAndroidResource(gvrContext, resourceId);
            break;

        case LINUX_FILESYSTEM:
            resourceKey = new GVRAndroidResource(
                    getFullPath(defaultPath, filePath));
            break;

        case ANDROID_SDCARD:
            String linuxPath = Environment.getExternalStorageDirectory()
                    .getAbsolutePath();
            resourceKey = new GVRAndroidResource(
                    getFullPath(linuxPath, defaultPath, filePath));
            break;

        case INPUT_STREAM:
            resourceKey = new GVRAndroidResource(getFullPath(defaultPath, filePath), volumeInputStream);
            break;

        case NETWORK:
            resourceKey = new GVRAndroidResource(gvrContext,
                    getFullURL(defaultPath, filePath), enableUrlLocalCache);
            break;

        default:
            throw new IOException(
                    String.format("Unrecognized volumeType %s", volumeType));
        }
        return addResource(resourceKey);
    }
1039147
public static GoogleCloudStorageItemInfo createInferredDirectory(StorageResourceId resourceId) {
    checkArgument(resourceId != null, "resourceId must not be null");
    return new GoogleCloudStorageItemInfo(
        resourceId,
        /* creationTime= */ 0,
        /* size= */ 0,
        /* location= */ null,
        /* storageClass= */ null);
  }
817528
@Override
    @Trivial
    public void open() throws ClassSource_Exception {
        String methodName = "open";
        if ( tc.isDebugEnabled() ) {
            Tr.debug(tc, MessageFormat.format("[ {0} ] [ {1} ] ENTER/RETURN", getHashText(), methodName));
        }
    }
109597
private String createVolume(String storageId, String snapshotId, int size) {
		String volumeType = Ec2IaasHandler.findStorageProperty(this.targetProperties, storageId, VOLUME_TYPE_PREFIX);
		if(volumeType == null) volumeType = "standard";

		CreateVolumeRequest createVolumeRequest = new CreateVolumeRequest()
				.withAvailabilityZone( this.availabilityZone )
				.withVolumeType( volumeType )
				.withSize( size ); // The size of the volume, in gigabytes.

		// EC2 snapshot IDs start with "snap-"...
		if(! Utils.isEmptyOrWhitespaces(snapshotId) && snapshotId.startsWith("snap-"))
			createVolumeRequest.withSnapshotId(snapshotId);

		CreateVolumeResult createVolumeResult = this.ec2Api.createVolume(createVolumeRequest);
		return createVolumeResult.getVolume().getVolumeId();
	}
866825
private StorageObject getObject(StorageResourceId resourceId)
      throws IOException {
    logger.atFine().log("getObject(%s)", resourceId);
    Preconditions.checkArgument(
        resourceId.isStorageObject(), "Expected full StorageObject id, got %s", resourceId);
    String bucketName = resourceId.getBucketName();
    String objectName = resourceId.getObjectName();
    Storage.Objects.Get getObject =
        configureRequest(gcs.objects().get(bucketName, objectName), bucketName);
    try {
      return getObject.execute();
    } catch (IOException e) {
      if (errorExtractor.itemNotFound(e)) {
        logger.atFine().withCause(e).log("getObject(%s): not found", resourceId);
        return null;
      }
      throw new IOException("Error accessing " + resourceId, e);
    }
  }
866852
private DiskStorage.Inserter startInsert(
      final String resourceId,
      final CacheKey key)
      throws IOException {
    maybeEvictFilesInCacheDir();
    return mStorage.insert(resourceId, key);
  }
606502
@Override
    public void write(String resourceId, byte[] data) {
        try {
            File file = this.cachedResources.get(resourceId);
            if (Objects.isNull(file)) {
                file = new File(localDir, resourceId + SUFFIX);
                Files.write(file.toPath(), data);
                this.cachedResources.put(resourceId, file);
            } else {
            	Files.write(file.toPath(), data);
            }
        } catch (Exception e) {
            LOG.log(Level.WARNING, "Caching of resource failed: " + resourceId, e);
        }
    }
235483
public Bucket enableDefaultEventBasedHold(String bucketName) throws StorageException {
    // [START storage_enable_default_event_based_hold]
    // Instantiate a Google Cloud Storage client
    Storage storage = StorageOptions.getDefaultInstance().getService();

    // The name of a bucket, e.g. "my-bucket"
    // String bucketName = "my-bucket";

    Bucket bucket =
        storage.update(BucketInfo.newBuilder(bucketName).setDefaultEventBasedHold(true).build());

    System.out.println("Default event-based hold was enabled for " + bucketName);
    // [END storage_enable_default_event_based_hold]
    return bucket;
  }
757948
public boolean open() throws RasterWritingFailureException {
        boolean ok;
        if (mapPath != null) {
            ok = writer.open(mapPath);
        } else if (locationPath != null && mapsetName != null && mapName != null) {
            ok = writer.open(mapName, locationPath, mapsetName);
        } else {
            return false;
        }

        return ok;
    }
845854
public void setResourceId(java.util.Collection<StringFilter> resourceId) {
        if (resourceId == null) {
            this.resourceId = null;
            return;
        }

        this.resourceId = new java.util.ArrayList<StringFilter>(resourceId);
    }
191093
def Open(self):
    
    if self._storage_file:
      raise IOError('Storage writer already opened.')

    self._storage_file = self._CreateStorageFile()

    if self._serializers_profiler:
      self._storage_file.SetSerializersProfiler(self._serializers_profiler)

    if self._storage_profiler:
      self._storage_file.SetStorageProfiler(self._storage_profiler)

    self._storage_file.Open(path=self._output_file, read_only=False)

    self._first_written_event_source_index = (
        self._storage_file.GetNumberOfEventSources())
    self._written_event_source_index = self._first_written_event_source_index
336928
def open(self):
        
        self.clearException()
        try:
            if self._isOpen:
                logger.warn("Resources already open. Closing them first before opening.")
                self._closeResources()
                self._isOpen = False

            assert not self._isOpen, "Sanity check failed: _isOpen should be false"
            logger.debug("Opening {}".format(self))
            self._openResources()
            self._isOpen = True

            if self.model:
                self.model.sigItemChanged.emit(self)
            else:
                logger.warning("Model not set yet: {}".format(self))

        except Exception as ex:
            if DEBUGGING:
                raise
            logger.exception("Error during tree item open: {}".format(ex))
            self.setException(ex)
1295593
@Override
  public GoogleCloudStorageItemInfo getItemInfo(StorageResourceId resourceId)
      throws IOException {
    logger.atFine().log("getItemInfo(%s)", resourceId);

    // Handle ROOT case first.
    if (resourceId.isRoot()) {
      return GoogleCloudStorageItemInfo.ROOT_INFO;
    }

    GoogleCloudStorageItemInfo itemInfo = null;

    // Determine object size.
    //
    // For buckets, size is 0.
    // For objects not found, size is -1.
    // For objects that exist, size is in number of bytes.
    if (resourceId.isBucket()) {
      Bucket bucket = getBucket(resourceId.getBucketName());
      if (bucket != null) {
        itemInfo = createItemInfoForBucket(resourceId, bucket);
      }
    } else {
      StorageObject object = getObject(resourceId);
      if (object != null) {
        itemInfo = createItemInfoForStorageObject(resourceId, object);
      }
    }

    if (itemInfo == null) {
      itemInfo = GoogleCloudStorageItemInfo.createNotFound(resourceId);
    }
    logger.atFine().log("getItemInfo: %s", itemInfo);
    return itemInfo;
  }
1116155
public void setResourceIds(java.util.Collection<String> resourceIds) {
        if (resourceIds == null) {
            this.resourceIds = null;
            return;
        }

        this.resourceIds = new com.amazonaws.internal.SdkInternalList<String>(resourceIds);
    }
361968
def _open_file(cls, writer_spec, filename_suffix, use_tmp_bucket=False):
    """"""
    if use_tmp_bucket:
      bucket = cls._get_tmp_gcs_bucket(writer_spec)
      account_id = cls._get_tmp_account_id(writer_spec)
    else:
      bucket = cls._get_gcs_bucket(writer_spec)
      account_id = cls._get_account_id(writer_spec)

    # GoogleCloudStorage format for filenames, Initial slash is required
    filename = "/%s/%s" % (bucket, filename_suffix)

    content_type = writer_spec.get(cls.CONTENT_TYPE_PARAM, None)

    options = {}
    if cls.ACL_PARAM in writer_spec:
      options["x-goog-acl"] = writer_spec.get(cls.ACL_PARAM)

    return cloudstorage.open(filename, mode="w", content_type=content_type,
                             options=options, _account_id=account_id)