Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

class S3BlobContainer extends AbstractBlobContainer {

public static final int BUF_SIZE = 8 * 1024;
protected final S3BlobStore blobStore;

protected final String keyPath;
Expand Down Expand Up @@ -91,9 +92,18 @@ public void writeBlob(String blobName, InputStream inputStream, long blobSize) t
if (blobExists(blobName)) {
throw new FileAlreadyExistsException("blob [" + blobName + "] already exists, cannot overwrite");
}
try (OutputStream stream = createOutput(blobName)) {
SocketAccess.doPrivilegedIOException(() -> Streams.copy(inputStream, stream));
}

SocketAccess.doPrivilegedIOException(() -> {
try (OutputStream os = createOutput(blobName);
InputStream is = inputStream) {
byte[] buf = new byte[BUF_SIZE];
int read;
while ((read = is.read(buf)) != -1) {
os.write(buf, 0, read);
}
}
return null;
});
}

@Override
Expand Down