ServiceOptionsT - the service options used by the channel to issue RPC requestsEntityT - the entity this channel writes data to. Possibly with additional configurationpublic abstract class BaseWriteChannel<ServiceOptionsT extends ServiceOptions<?,?,ServiceOptionsT>,EntityT extends Serializable> extends Object implements WriteChannel
WriteChannel.| Modifier and Type | Class and Description |
|---|---|
protected static class |
BaseWriteChannel.BaseState<ServiceOptionsT extends ServiceOptions<?,?,ServiceOptionsT>,EntityT extends Serializable> |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseWriteChannel(ServiceOptionsT options,
EntityT entity,
String uploadId) |
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
buffer() |
RestorableState<WriteChannel> |
capture()
Captures the write channel state so that it can be saved and restored afterwards.
|
protected int |
chunkSize() |
void |
chunkSize(int chunkSize)
Sets the minimum size that will be written by a single RPC.
|
void |
close() |
protected int |
defaultChunkSize() |
protected EntityT |
entity() |
protected abstract void |
flushBuffer(int length,
boolean last)
|
boolean |
isOpen() |
protected int |
limit() |
protected int |
minChunkSize() |
protected ServiceOptionsT |
options() |
protected int |
position() |
protected void |
restore(BaseWriteChannel.BaseState state)
Restores the state of the current write channel given a
BaseWriteChannel.BaseState object. |
protected abstract BaseWriteChannel.BaseState.Builder<ServiceOptionsT,EntityT> |
stateBuilder()
Creates a
BaseWriteChannel.BaseState.Builder for the current write channel. |
protected String |
uploadId() |
int |
write(ByteBuffer byteBuffer) |
protected BaseWriteChannel(ServiceOptionsT options, EntityT entity, String uploadId)
protected int minChunkSize()
protected int defaultChunkSize()
protected abstract void flushBuffer(int length,
boolean last)
length - the number of bytes to write from buffer()last - if true the resumable session is closedprotected ServiceOptionsT options()
protected EntityT entity()
protected String uploadId()
protected int position()
protected byte[] buffer()
protected int limit()
protected int chunkSize()
public final void chunkSize(int chunkSize)
WriteChannelchunkSize in interface WriteChannelpublic final int write(ByteBuffer byteBuffer) throws IOException
write in interface WritableByteChannelIOExceptionpublic final void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface ChannelIOExceptionprotected abstract BaseWriteChannel.BaseState.Builder<ServiceOptionsT,EntityT> stateBuilder()
BaseWriteChannel.BaseState.Builder for the current write channel.public RestorableState<WriteChannel> capture()
WriteChannelWriteChannel and the restored one should not both be used. Closing one channel
causes the other channel to close; subsequent writes will fail.capture in interface Restorable<WriteChannel>capture in interface WriteChannelRestorableState object that contains the write channel state and can restore
it afterwards.protected void restore(BaseWriteChannel.BaseState state)
BaseWriteChannel.BaseState object.Copyright © 2016 Google. All rights reserved.