Class S3ARemoteObjectReader
java.lang.Object
org.apache.hadoop.fs.s3a.prefetch.S3ARemoteObjectReader
- All Implemented Interfaces:
Closeable,AutoCloseable
Provides functionality to read S3 file one block at a time.
-
Constructor Summary
ConstructorsConstructorDescriptionS3ARemoteObjectReader(S3ARemoteObject remoteObject) Constructs an instance ofS3ARemoteObjectReader. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intread(ByteBuffer buffer, long offset, int size) Stars reading atoffsetand reads uptosizebytes intobuffer.
-
Constructor Details
-
S3ARemoteObjectReader
Constructs an instance ofS3ARemoteObjectReader.- Parameters:
remoteObject- The S3 file to read.- Throws:
IllegalArgumentException- if remoteObject is null.
-
-
Method Details
-
read
Stars reading atoffsetand reads uptosizebytes intobuffer.- Parameters:
buffer- the buffer into which data is returnedoffset- the absolute offset into the underlying file where reading starts.size- the number of bytes to be read.- Returns:
- number of bytes actually read.
- Throws:
IOException- if there is an error reading from the file.IllegalArgumentException- if buffer is null.IllegalArgumentException- if offset is outside of the range [0, file size].IllegalArgumentException- if size is zero or negative.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-