public abstract class BaseWriteChannel<ServiceOptionsT,EntityT> implements WriteChannel
Type Parameters |
---|
Name | Description |
ServiceOptionsT | |
EntityT | |
Constructors
BaseWriteChannel(ServiceOptionsT options, EntityT entity, String uploadId)
protected BaseWriteChannel(ServiceOptionsT options, EntityT entity, String uploadId)
Parameters |
---|
Name | Description |
options | ServiceOptionsT
|
entity | EntityT
|
uploadId | String
|
Methods
capture()
public RestorableState<WriteChannel> capture()
Captures the write channel state so that it can be saved and restored afterwards. The original
WriteChannel
and the restored one should not both be used. Closing one channel causes
the other channel to close; subsequent writes will fail.
close()
public final void close()
flushBuffer(int length, boolean last)
protected abstract void flushBuffer(int length, boolean last)
Parameters |
---|
Name | Description |
length | int
the number of bytes to write from #getBuffer()
|
last | boolean
if true the resumable session is closed
|
getBuffer()
protected byte[] getBuffer()
Returns |
---|
Type | Description |
byte[] | |
getChunkSize()
protected int getChunkSize()
Returns |
---|
Type | Description |
int | |
getDefaultChunkSize()
protected int getDefaultChunkSize()
Returns |
---|
Type | Description |
int | |
getEntity()
protected EntityT getEntity()
Returns |
---|
Type | Description |
EntityT | |
getLimit()
Returns |
---|
Type | Description |
int | |
getMinChunkSize()
protected int getMinChunkSize()
Returns |
---|
Type | Description |
int | |
getOptions()
protected ServiceOptionsT getOptions()
Returns |
---|
Type | Description |
ServiceOptionsT | |
getPosition()
protected long getPosition()
Returns |
---|
Type | Description |
long | |
getUploadId()
protected String getUploadId()
isOpen()
restore(BaseWriteChannel.BaseState state)
protected void restore(BaseWriteChannel.BaseState state)
Restores the state of the current write channel given a BaseState object.
setChunkSize(int chunkSize)
public final void setChunkSize(int chunkSize)
Sets the minimum size that will be written by a single RPC. Written data will be buffered and
only flushed upon reaching this size or closing the channel.
Parameter |
---|
Name | Description |
chunkSize | int
|
stateBuilder()
protected abstract BaseWriteChannel.BaseState.Builder<ServiceOptionsT,EntityT> stateBuilder()
Creates a BaseState.Builder for the current write channel.
Returns |
---|
Type | Description |
Builder<ServiceOptionsT,EntityT> | |
write(ByteBuffer byteBuffer)
public final int write(ByteBuffer byteBuffer)
Returns |
---|
Type | Description |
int | |