T - type of stream created.@VisibleForTesting public abstract static class UploadContentProviders.BaseContentProvider<T extends InputStream> extends Object implements software.amazon.awssdk.http.ContentStreamProvider, Closeable
| Modifier | Constructor and Description |
|---|---|
protected |
BaseContentProvider(int size)
Constructor.
|
protected |
BaseContentProvider(int size,
Supplier<Boolean> isOpen)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the current stream.
|
protected abstract T |
createNewStream()
Override point for subclasses to create their new streams.
|
protected T |
getCurrentStream()
Current stream.
|
int |
getSize()
Size as set by constructor parameter.
|
LocalDateTime |
getStartTime()
When did this upload start?
|
int |
getStreamCreationCount()
How many times has a stream been created?
|
InputStream |
newStream()
Create a new stream.
|
protected T |
setCurrentStream(T stream)
Set the current stream.
|
String |
toString() |
protected BaseContentProvider(int size)
size - size of the data. Must be non-negative.public void close()
close in interface Closeableclose in interface AutoCloseablepublic final InputStream newStream()
Calls close() to ensure that any existing stream is closed,
then checkOpen() to verify that the data source is still open.
Logs if this is a subsequent event as it implies a failure of the first attempt.
newStream in interface software.amazon.awssdk.http.ContentStreamProviderprotected abstract T createNewStream()
public int getStreamCreationCount()
public int getSize()
public LocalDateTime getStartTime()
protected T getCurrentStream()
newStream() is called, this is set to the new value,
after closing the previous one.
Why? The AWS SDK implementations do this, so there is an implication that it is needed to avoid keeping streams open on retries.
protected T setCurrentStream(T stream)
stream - the new streamCopyright © 2008–2024 Apache Software Foundation. All rights reserved.