Я пытаюсь прочитать файл из корзины Google Cloud Storage, используя этот код
Blob blob = storage.get(BlobId.of(Constants.GCS_BUCKET, srcFilename));
printBlob(blob.reader());
private void printBlob(ReadChannel reader) {
try {
WritableByteChannel outChannel = Channels.newChannel(System.out);
ByteBuffer bytes = ByteBuffer.allocate(64 * 1024);
while (reader. read(bytes) > 0) {
bytes.flip();
outChannel.write(bytes);
bytes.clear();
}
}
catch (Exception e) {
}
}
При выполнении reader.read(bytes)
, тогда код выдает это исключение
[INFO] GCLOUD: Caused by:
[INFO] GCLOUD: java.lang.NoSuchMethodError: com.google.api.services.storage.Storage$Objects$Get.setReturnRawInputStream(Z)Lcom/google/api/client/googleapis/services/AbstractGoogleClientRequest;
[INFO] GCLOUD: at com.google.cloud.storage.spi.v1.HttpStorageRpc.createReadRequest(HttpStorageRpc.java:658)
[INFO] GCLOUD: at com.google.cloud.storage.spi.v1.HttpStorageRpc.read(HttpStorageRpc.java:693)
[INFO] GCLOUD: at com.google.cloud.storage.BlobReadChannel$1.call(BlobReadChannel.java:127)
[INFO] GCLOUD: at com.google.cloud.storage.BlobReadChannel$1.call(BlobReadChannel.java:124)