Partager via


BlobRange Class

  • java.lang.Object
    • com.azure.storage.blob.models.BlobRange

public final class BlobRange

This is a representation of a range of bytes on a blob, 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 BlobRange value will default to the entire range of the blob.

Constructor Summary

Constructor Description
BlobRange(long offset)

Specifies the download operation to start from the offset position (zero-based) and download the rest of the entire blob to the end.

BlobRange(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 and Description
Long getCount()

How many bytes to include in the range.

long getOffset()

The start of the range.

String toHeaderValue()
String toString()

Methods inherited from java.lang.Object

Constructor Details

BlobRange

public BlobRange(long offset)

Specifies the download operation to start from the offset position (zero-based) and download the rest of the entire blob to the end.

Parameters:

offset - the zero-based position to start downloading

BlobRange

public BlobRange(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

Method Details

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

getOffset

public long getOffset()

The start of the range. Must be greater than or equal to 0.

Returns:

the offset for the range

toHeaderValue

public String toHeaderValue()

Returns:

toString() if count isn't null or offset isn't 0, otherwise null.

toString

public String toString()

Overrides:

BlobRange.toString()

Returns:

A String compliant with the format of the Azure Storage x-ms-range and Range headers.

Applies to