Class ObjectPositionReader

  • All Implemented Interfaces:
    PositionReader, java.io.Closeable, java.lang.AutoCloseable

    public abstract class ObjectPositionReader
    extends java.lang.Object
    implements PositionReader
    A stream for reading data using position reader.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String mBucketName
      Name of the bucket the object resides in.
      protected long mFileLength
      Length of the file.
      protected java.lang.String mPath
      Path of the file when it is uploaded to object storage.
    • Constructor Summary

      Constructors 
      Constructor Description
      ObjectPositionReader​(java.lang.String bucketName, java.lang.String path, long fileLength)  
    • Field Detail

      • mPath

        protected final java.lang.String mPath
        Path of the file when it is uploaded to object storage.
      • mFileLength

        protected final long mFileLength
        Length of the file.
      • mBucketName

        protected final java.lang.String mBucketName
        Name of the bucket the object resides in.
    • Constructor Detail

      • ObjectPositionReader

        public ObjectPositionReader​(java.lang.String bucketName,
                                    java.lang.String path,
                                    long fileLength)
        Parameters:
        bucketName - the bucket name
        path - path of the file when it is uploaded to object storage
        fileLength - the file length
    • Method Detail

      • readInternal

        public int readInternal​(long position,
                                ReadTargetBuffer buffer,
                                int length)
                         throws java.io.IOException
        Specified by:
        readInternal in interface PositionReader
        Parameters:
        position - position of the file to start reading data
        buffer - target byte buffer
        length - bytes to read
        Returns:
        bytes read, or -1 none of data is read
        Throws:
        java.io.IOException
      • openObjectInputStream

        protected abstract java.io.InputStream openObjectInputStream​(long position,
                                                                     int bytesToRead)
                                                              throws java.io.IOException
        Parameters:
        position - position of the file to start reading data
        bytesToRead - bytes to read
        Returns:
        input stream of Object Storage's API
        Throws:
        java.io.IOException