Interface FileRange

All Known Implementing Classes:
CombinedFileRange, FileRangeImpl

public interface FileRange
  • Method Details

    • getOffset

      long getOffset()
      Get the starting offset of the range.
      Returns:
      the byte offset of the start
    • getLength

      int getLength()
      Get the length of the range.
      Returns:
      the number of bytes in the range.
    • getData

      Get the future data for this range.
      Returns:
      the future for the ByteBuffer that contains the data
    • setData

      void setData(CompletableFuture<ByteBuffer> data)
      Set a future for this range's data. This method is called by PositionedReadable.readVectored(java.util.List<? extends org.apache.hadoop.fs.FileRange>, java.util.function.IntFunction<java.nio.ByteBuffer>) to store the data for the user to pick up later via getData().
      Parameters:
      data - the future of the ByteBuffer that will have the data
    • getReference

      Object getReference()
      Get any reference passed in to the file range constructor. This is not used by any implementation code; it is to help bind this API to libraries retrieving multiple stripes of data in parallel.
      Returns:
      a reference or null.
    • createFileRange

      static FileRange createFileRange(long offset, int length)
      Factory method to create a FileRange object.
      Parameters:
      offset - starting offset of the range.
      length - length of the range.
      Returns:
      a new instance of FileRangeImpl.
    • createFileRange

      static FileRange createFileRange(long offset, int length, Object reference)
      Factory method to create a FileRange object.
      Parameters:
      offset - starting offset of the range.
      length - length of the range.
      reference - nullable reference to store in the range.
      Returns:
      a new instance of FileRangeImpl.