Class RangeSpec

java.lang.Object
com.google.cloud.storage.RangeSpec

@BetaApi @Immutable public abstract class RangeSpec extends Object
Defines a range with a begin offset and optional maximum length.
Since:
2.51.0 This new api is in preview and is subject to breaking changes.
  • Method Details

    • begin

      @BetaApi public abstract long begin()
      The beginning of the range.
      Since:
      2.51.0 This new api is in preview and is subject to breaking changes.
    • maxLength

      @BetaApi public abstract OptionalLong maxLength()
      The max length of the range if defined.
      Since:
      2.51.0 This new api is in preview and is subject to breaking changes.
      See Also:
      • RangeSpec.RangeSpecWithMaxLength
    • withMaxLength

      @BetaApi public abstract @NonNull RangeSpec withMaxLength(long maxLength)
      Create a new instance of RangeSpec keeping this.begin() and with maxLength as its new maxLength.
      Since:
      2.51.0 This new api is in preview and is subject to breaking changes.
    • equals

      public abstract boolean equals(Object o)
      Overrides:
      equals in class Object
      Since:
      2.51.0 This new api is in preview and is subject to breaking changes.
    • hashCode

      public abstract int hashCode()
      Overrides:
      hashCode in class Object
      Since:
      2.51.0 This new api is in preview and is subject to breaking changes.
    • toString

      public abstract String toString()
      Overrides:
      toString in class Object
      Since:
      2.51.0 This new api is in preview and is subject to breaking changes.
    • beginAt

      @BetaApi public static @NonNull RangeSpec beginAt(long begin)
      Create a new RangeSpec with the provided begin.
      Parameters:
      begin - The beginning of the range, must be >= 0
      Throws:
      IllegalArgumentException - if begin is < 0
      Since:
      2.51.0 This new api is in preview and is subject to breaking changes.
    • of

      @BetaApi public static @NonNull RangeSpec of(long begin, long maxLength)
      Create a new RangeSpec with the provided begin and maxLength.
      Parameters:
      begin - The beginning of the range, must be >= 0
      maxLength - The max length of the range, must be >= 0. 0 means no limit.
      Throws:
      IllegalArgumentException - if begin is < 0, or if maxLength is < 0
      Since:
      2.51.0 This new api is in preview and is subject to breaking changes.
    • all

      @BetaApi public static @NonNull RangeSpec all()
      A RangeSpec that represents to read from 0 to EOF
      Since:
      2.51.0 This new api is in preview and is subject to breaking changes.