Class S3ARemoteObject

java.lang.Object
org.apache.hadoop.fs.s3a.prefetch.S3ARemoteObject

public class S3ARemoteObject extends Object
Encapsulates low level interactions with S3 object on AWS.
  • Constructor Details

  • Method Details

    • getReadInvoker

      public Invoker getReadInvoker()
      Gets an instance of Invoker for interacting with S3 API.
      Returns:
      an instance of Invoker for interacting with S3 API.
    • getStatistics

      public S3AInputStreamStatistics getStatistics()
      Gets an instance of S3AInputStreamStatistics used for reporting access metrics.
      Returns:
      an instance of S3AInputStreamStatistics used for reporting access metrics.
    • getPath

      public String getPath()
      Gets the path of this file.
      Returns:
      the path of this file.
    • getPath

      public static String getPath(S3ObjectAttributes s3Attributes)
      Gets the path corresponding to the given s3Attributes.
      Parameters:
      s3Attributes - attributes of an S3 object.
      Returns:
      the path corresponding to the given s3Attributes.
    • size

      public long size()
      Gets the size of this file. Its value is cached once obtained from AWS.
      Returns:
      the size of this file.
    • openForRead

      public software.amazon.awssdk.core.ResponseInputStream<software.amazon.awssdk.services.s3.model.GetObjectResponse> openForRead(long offset, int size) throws IOException
      Opens a section of the file for reading.
      Parameters:
      offset - Start offset (0 based) of the section to read.
      size - Size of the section to read.
      Returns:
      an InputStream corresponding to the given section of this file.
      Throws:
      IOException - if there is an error opening this file section for reading.
      IllegalArgumentException - if offset is negative.
      IllegalArgumentException - if offset is greater than or equal to file size.
      IllegalArgumentException - if size is greater than the remaining bytes.