@Test public void lazyReadFileAtSpecificGeneration_fails_whenReadConsistencyStrict() throws IOException { long generation = 5L; MockHttpTransport transport = mockTransport(jsonErrorResponse(ErrorResponses.NOT_FOUND)); List<HttpRequest> requests = new ArrayList<>(); Storage storage = new Storage(transport, JSON_FACTORY, requests::add); GoogleCloudStorageReadOptions options = GoogleCloudStorageReadOptions.builder().setFastFailOnNotFound(false).build(); GoogleCloudStorageReadChannel readChannel = createReadChannel(storage, options, generation); assertThrows(FileNotFoundException.class, () -> readChannel.size()); }
@Override public long size() throws IOException { throwIfNotOpen(); if (!metadataInitialized) { initMetadata(fetchInitialMetadata()); } return size; }
GoogleCloudStorageReadChannel implements SeekableByteChannel { @Override public long size() throws IOException { throwIfNotOpen(); if (!metadataInitialized) { initMetadata(fetchInitialMetadata()); } return size; } }
GoogleCloudStorageReadChannel implements SeekableByteChannel { @Override public long size() throws IOException { throwIfNotOpen(); if (!metadataInitialized) { initMetadata(fetchInitialMetadata()); } return size; } GoogleCloudStorageReadChannel(
      Storage gcs,
      String bucketName,
      String objectName,
      ApiErrorExtractor errorExtractor,
      ClientRequestHelper<StorageObject> requestHelper);  GoogleCloudStorageReadChannel(
      Storage gcs,
      String bucketName,
      String objectName,
      ApiErrorExtractor errorExtractor,
      ClientRequestHelper<StorageObject> requestHelper,
      @Nonnull GoogleCloudStorageReadOptions readOptions);  GoogleCloudStorageReadChannel(
      Storage gcs,
      StorageResourceId resourceId,
      ApiErrorExtractor errorExtractor,
      ClientRequestHelper<StorageObject> requestHelper,
      @Nonnull GoogleCloudStorageReadOptions readOptions); protected  GoogleCloudStorageReadChannel(
      String bucketName, String objectName, @Nonnull GoogleCloudStorageReadOptions readOptions); }
GoogleCloudStorageReadChannel implements SeekableByteChannel { @Override public long size() throws IOException { throwIfNotOpen(); if (!metadataInitialized) { initMetadata(fetchInitialMetadata()); } return size; } GoogleCloudStorageReadChannel(
      Storage gcs,
      String bucketName,
      String objectName,
      ApiErrorExtractor errorExtractor,
      ClientRequestHelper<StorageObject> requestHelper);  GoogleCloudStorageReadChannel(
      Storage gcs,
      String bucketName,
      String objectName,
      ApiErrorExtractor errorExtractor,
      ClientRequestHelper<StorageObject> requestHelper,
      @Nonnull GoogleCloudStorageReadOptions readOptions);  GoogleCloudStorageReadChannel(
      Storage gcs,
      StorageResourceId resourceId,
      ApiErrorExtractor errorExtractor,
      ClientRequestHelper<StorageObject> requestHelper,
      @Nonnull GoogleCloudStorageReadOptions readOptions); protected  GoogleCloudStorageReadChannel(
      String bucketName, String objectName, @Nonnull GoogleCloudStorageReadOptions readOptions); void setMaxRetries(int maxRetries); @Override int read(ByteBuffer buffer); @Override SeekableByteChannel truncate(long size); @Override int write(ByteBuffer src); @Override boolean isOpen(); @Override void close(); @Override long position(); @Override SeekableByteChannel position(long newPosition); @Override long size(); }
GoogleCloudStorageReadChannel implements SeekableByteChannel { @Override public long size() throws IOException { throwIfNotOpen(); if (!metadataInitialized) { initMetadata(fetchInitialMetadata()); } return size; } GoogleCloudStorageReadChannel(
      Storage gcs,
      String bucketName,
      String objectName,
      ApiErrorExtractor errorExtractor,
      ClientRequestHelper<StorageObject> requestHelper);  GoogleCloudStorageReadChannel(
      Storage gcs,
      String bucketName,
      String objectName,
      ApiErrorExtractor errorExtractor,
      ClientRequestHelper<StorageObject> requestHelper,
      @Nonnull GoogleCloudStorageReadOptions readOptions);  GoogleCloudStorageReadChannel(
      Storage gcs,
      StorageResourceId resourceId,
      ApiErrorExtractor errorExtractor,
      ClientRequestHelper<StorageObject> requestHelper,
      @Nonnull GoogleCloudStorageReadOptions readOptions); protected  GoogleCloudStorageReadChannel(
      String bucketName, String objectName, @Nonnull GoogleCloudStorageReadOptions readOptions); void setMaxRetries(int maxRetries); @Override int read(ByteBuffer buffer); @Override SeekableByteChannel truncate(long size); @Override int write(ByteBuffer src); @Override boolean isOpen(); @Override void close(); @Override long position(); @Override SeekableByteChannel position(long newPosition); @Override long size();  }