Class InMemoryObjectReadChannel
- java.lang.Object
-
- com.google.cloud.hadoop.gcsio.GoogleCloudStorageReadChannel
-
- com.google.cloud.hadoop.gcsio.testing.InMemoryObjectReadChannel
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ByteChannel,Channel,ReadableByteChannel,SeekableByteChannel,WritableByteChannel
public class InMemoryObjectReadChannel extends GoogleCloudStorageReadChannel
A SeekableByteChannel based on GoogleCloudStorageReadChannel that supports reading from in-memory byte stream.
-
-
Field Summary
-
Fields inherited from class com.google.cloud.hadoop.gcsio.GoogleCloudStorageReadChannel
contentChannelPosition, currentPosition, metadataInitialized
-
-
Constructor Summary
Constructors Constructor Description InMemoryObjectReadChannel(String bucketName, String objectName, byte[] content, GoogleCloudStorageReadOptions readOptions)Creates a new instance of InMemoryObjectReadChannel withreadOptionsplumbed into the base class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GoogleCloudStorageItemInfogetInitialMetadata()ReturnsGoogleCloudStorageItemInfoused to initialize metadata in constructor ornullifGoogleCloudStorageReadOptions.isFastFailOnNotFoundEnabled()is set tofalse.protected InputStreamopenStream(long bytesToRead)Opens the underlying byte array stream, sets its position to currentPosition and sets size to size of the byte array.-
Methods inherited from class com.google.cloud.hadoop.gcsio.GoogleCloudStorageReadChannel
close, closeContentChannel, createDataRequest, createMetadataRequest, initMetadata, initMetadata, isOpen, position, position, read, setMaxRetries, setSize, size, truncate, validatePosition, write
-
-
-
-
Constructor Detail
-
InMemoryObjectReadChannel
public InMemoryObjectReadChannel(String bucketName, String objectName, byte[] content, GoogleCloudStorageReadOptions readOptions) throws IOException
Creates a new instance of InMemoryObjectReadChannel withreadOptionsplumbed into the base class.- Throws:
IOException
-
-
Method Detail
-
getInitialMetadata
@Nullable protected GoogleCloudStorageItemInfo getInitialMetadata() throws IOException
Description copied from class:GoogleCloudStorageReadChannelReturnsGoogleCloudStorageItemInfoused to initialize metadata in constructor ornullifGoogleCloudStorageReadOptions.isFastFailOnNotFoundEnabled()is set tofalse.- Overrides:
getInitialMetadatain classGoogleCloudStorageReadChannel- Throws:
IOException
-
openStream
protected InputStream openStream(long bytesToRead) throws IOException
Opens the underlying byte array stream, sets its position to currentPosition and sets size to size of the byte array.- Overrides:
openStreamin classGoogleCloudStorageReadChannel- Parameters:
bytesToRead- ignored.- Throws:
IOException- on IO error
-
-