@Test @SneakyThrows void writeByteByByteChunked() { writeByteByByte(multipartChunkWithTail); tested.close(); assertThat(bytesSentDirectly.getAllValues()).isEmpty(); assertThat(uploadChunk.getAllValues()).hasSize(2); assertThat(uploadChunk.getAllValues().get(0).getInputStream()) .hasContent(new String(Arrays.copyOfRange(multipartChunkWithTail, 0, BUFFER_SIZE))); int partialPartSize = (int) uploadChunk.getAllValues().get(1).getPartSize(); byte[] partialChunk = new byte[partialPartSize]; ByteStreams.readFully(uploadChunk.getAllValues().get(1).getInputStream(), partialChunk, 0, partialPartSize); assertThat(new String(partialChunk)) .isEqualTo(new String(Arrays.copyOfRange( multipartChunkWithTail, BUFFER_SIZE, multipartChunkWithTail.length) ) ); }
@Override @Synchronized public void close() throws IOException { if (currentOutputStream == null) { return; } if (isMultiPartUpload()) { finishMultiPartUpload(); } else { finishSimpleUpload(); } }
MultipartUploadS3StorageOutputStream extends OutputStream { @Override @Synchronized public void close() throws IOException { if (currentOutputStream == null) { return; } if (isMultiPartUpload()) { finishMultiPartUpload(); } else { finishSimpleUpload(); } } }
MultipartUploadS3StorageOutputStream extends OutputStream { @Override @Synchronized public void close() throws IOException { if (currentOutputStream == null) { return; } if (isMultiPartUpload()) { finishMultiPartUpload(); } else { finishSimpleUpload(); } } MultipartUploadS3StorageOutputStream(String bucketName, String objectKey, AmazonS3 amazonS3,
                                         ExecutorService executorService,
                                         List<? extends ResourceWriteCallback> callbacks); }
MultipartUploadS3StorageOutputStream extends OutputStream { @Override @Synchronized public void close() throws IOException { if (currentOutputStream == null) { return; } if (isMultiPartUpload()) { finishMultiPartUpload(); } else { finishSimpleUpload(); } } MultipartUploadS3StorageOutputStream(String bucketName, String objectKey, AmazonS3 amazonS3,
                                         ExecutorService executorService,
                                         List<? extends ResourceWriteCallback> callbacks); @Override @Synchronized void write(byte[] bytes, int off, int len); @Override @Synchronized void write(int b); @Override @Synchronized void close(); }
MultipartUploadS3StorageOutputStream extends OutputStream { @Override @Synchronized public void close() throws IOException { if (currentOutputStream == null) { return; } if (isMultiPartUpload()) { finishMultiPartUpload(); } else { finishSimpleUpload(); } } MultipartUploadS3StorageOutputStream(String bucketName, String objectKey, AmazonS3 amazonS3,
                                         ExecutorService executorService,
                                         List<? extends ResourceWriteCallback> callbacks); @Override @Synchronized void write(byte[] bytes, int off, int len); @Override @Synchronized void write(int b); @Override @Synchronized void close();  }