使用Java从云存储下载文件元数据

时间:2016-08-17 08:24:16

标签: google-cloud-storage bucket

我试图从我的云存储中删除数据,但我自己没有设法做到这一点。我正在运行此代码:

public static byte[] downloadBucket(String bucketName, String fileName) throws IOException, GeneralSecurityException {
  Storage storage = StorageFactory.getService();

  Get get = null;
  ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  try {
      get = storage.objects().get(bucketName, fileName);
      get.executeAndDownloadTo(outputStream);
  } catch (IOException e) {
      e.printStackTrace();
  }
  return outputStream.toByteArray();
}

我除了一些JSON,但到目前为止我只能得到这个:

[B @ fe18270

我应该做什么或者我在这里想念什么? 非常感谢

0 个答案:

没有答案