ByteArrayInputStream bais = new ByteArrayInputStream(BlobstoreServiceFactory.getBlobstoreService().fetchData(new BlobKey(blobKeyString), 0, BlobstoreService.MAX_BLOB_FETCH_SIZE - 1));
IOUtils.copyStream(bais, outputStream);
outputStream.write("_123".getBytes());
} else {
GcsFilename filename = new GcsFilename("GcsBucket", gsObjectName);
GcsFileMetadata metadata = service.getMetadata(filename);
if (metadata == null) {
throw new IllegalStateException("Null GCS metadata: " + filename);
}
mimeType = metadata.getOptions().getMimeType();
try (InputStream inputStream = Channels.newInputStream(service.openReadChannel(metadata.getFilename(), 0))) {
IOUtils.copyStream(inputStream, outputStream);
}
outputStream.write("_123".getBytes());
}