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.
Returns
close()
public final void close()
Exceptions
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
getChunkSize()
protected int getChunkSize()
Returns
getDefaultChunkSize()
protected int getDefaultChunkSize()
Returns
getEntity()
protected EntityT getEntity()
Returns
getLimit()
Returns
getMinChunkSize()
protected int getMinChunkSize()
Returns
getOptions()
protected ServiceOptionsT getOptions()
Returns
Type | Description |
ServiceOptionsT | |
getPosition()
protected long getPosition()
Returns
getUploadId()
protected String getUploadId()
Returns
isOpen()
Returns
restore(BaseWriteChannel.BaseState state)
protected void restore(BaseWriteChannel.BaseState state)
Restores the state of the current write channel given a BaseState object.
Parameter
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)
Parameter
Returns
Exceptions