Class ReadAsChannel (2.52.2)

public final class ReadAsChannel extends ReadProjectionConfigs.BaseConfig<ScatteringByteChannel,BaseObjectReadSessionStreamRead.StreamingRead>

Read a range of bytes as a non-blocking ScatteringByteChannel

The returned channel will be non-blocking for all read calls. If bytes have not yet asynchronously been delivered from Google Cloud Storage the method will return rather than waiting for the bytes to arrive.

The resulting ScatteringByteChannel MUST be close()ed to avoid leaking memory

Instances of this class are immutable and thread safe. See Also: <xref uid="com.google.cloud.storage.BlobReadSession.<Projection>readAs(com.google.cloud.storage.ReadProjectionConfig<Projection>)" data-throw-if-not-resolved="false">BlobReadSession#readAs(ReadProjectionConfig), ScatteringByteChannel, ReadProjectionConfigs#asChannel()

Inheritance

Object > ReadProjectionConfig<Projection> > com.google.cloud.storage.ReadProjectionConfigs.BaseConfig > ReadAsChannel

Methods

equals(Object o)

public boolean equals(Object o)
Parameter
Name Description
o Object
Returns
Type Description
boolean
Overrides

getRange()

public RangeSpec getRange()

The RangeSpec to be used for any read using this instance.

Default: RangeSpec#all()

Returns
Type Description
RangeSpec

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

toString()

public String toString()
Returns
Type Description
String
Overrides

withRangeSpec(RangeSpec range)

public ReadAsChannel withRangeSpec(RangeSpec range)

Return an instance with the RangeSpec set to the specified value.

Default: RangeSpec#all() See Also: #getRange()

Parameter
Name Description
range RangeSpec

The RangeSpec to be used for any read using the returned instance. Must be non-null.

Returns
Type Description
ReadAsChannel