Class FileRange

java.lang.Object
com.azure.storage.file.datalake.models.FileRange

public final class FileRange extends Object
This is a representation of a range of bytes on a file, typically used during a download operation. This type is immutable to ensure thread-safety of requests, so changing the values for a different operation requires construction of a new object. Passing null as a FileRange value will default to the entire range of the file.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FileRange(long offset)
    Specifies the download operation to start from the offset position (zero-based) and download the rest of the entire file to the end.
    FileRange(long offset, Long count)
    Specifies the download operation to start from the offset position (zero-based) and download the count number of bytes.
  • Method Summary

    Modifier and Type
    Method
    Description
    How many bytes to include in the range.
    long
    The start of the range.
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FileRange

      public FileRange(long offset)
      Specifies the download operation to start from the offset position (zero-based) and download the rest of the entire file to the end.
      Parameters:
      offset - the zero-based position to start downloading
      Throws:
      IllegalArgumentException - If offset is less than 0.
    • FileRange

      public FileRange(long offset, Long count)
      Specifies the download operation to start from the offset position (zero-based) and download the count number of bytes.
      Parameters:
      offset - the zero-based position to start downloading
      count - the number of bytes to download
      Throws:
      IllegalArgumentException - If offset or count is less than 0.
  • Method Details

    • getOffset

      public long getOffset()
      The start of the range. Must be greater than or equal to 0.
      Returns:
      the offset for the range
    • getCount

      public Long getCount()
      How many bytes to include in the range. Must be greater than or equal to 0 if specified.
      Returns:
      the number bytes to include in the range
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      A String compliant with the format of the Azure Storage x-ms-range and Range headers.
    • toHeaderValue

      public String toHeaderValue()
      Returns:
      toString() if count isn't null or offset isn't 0, otherwise null.