I am trying to create a new file in one of my Google Cloud Storage Codes. Here is the code I wrote:
InputStream stream = new ByteArrayInputStream(report.getBytes(StandardCharsets.UTF_8.name()));
GcsFilename filename = new GcsFilename(BUCKET_NAME, csvFileName);
GcsFileOptions options = GcsFileOptions.getDefaultInstance();
GcsOutputChannel outputChannel = gcsService.createOrReplace(filename, options);
copy(stream, Channels.newOutputStream(outputChannel));
The code works without errors, but the bucket remains empty. I am 99% sure that I wrote the code correctly (it works for me in another project), but the problem is related to the GCS bucket settings. Thank.
source
share