public class MultiPartOutputStream extends OutputStream
OutputStream
which packages data written to it into discrete StreamPart
s which can be obtained
in a separate thread via iteration and uploaded to S3.
A single MultiPartOutputStream
is allocated a range of part numbers it can assign to the StreamPart
s
it produces, which is determined at construction.
It's essential to call
close()
when finished so that it can create the final StreamPart
and consumers
can finish.
Writing to the stream may lead to trying to place a completed part on a queue,
which will block if the queue is full and may lead to an InterruptedException
.
Modifier and Type | Field and Description |
---|---|
static int |
S3_MIN_PART_SIZE |
Modifier and Type | Method and Description |
---|---|
void |
close()
Packages any remaining data into a
StreamPart and signals to the StreamTransferManager that there are no more parts
afterwards. |
String |
toString() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
flush
public static final int S3_MIN_PART_SIZE
public void write(int b)
write
in class OutputStream
public void write(byte[] b, int off, int len)
write
in class OutputStream
public void write(byte[] b)
write
in class OutputStream
public void close()
StreamPart
and signals to the StreamTransferManager
that there are no more parts
afterwards. You cannot write to the stream after it has been closed.close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
Copyright © 2020. All rights reserved.