# Class ByteRange (5.0.3)

    public class ByteRange

A byte range as parsed from a request Range header. Format produced by this class is
also compatible with the X-AppEngine-BlobRange header, used for serving sub-ranges of
blobs.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> ByteRange

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Methods

### parse(String byteRange)

    public static ByteRange parse(String byteRange)

Parse byte range from header.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `byteRange` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Byte range string as received from header. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.blobstore.ByteRange` | ByteRange object set to byte range as parsed from string. |

### parseContentRange(String contentRange)

    public static ByteRange parseContentRange(String contentRange)

Parse content range from header for byte-range only.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `contentRange` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Content range string as received from header. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.blobstore.ByteRange` | ByteRange object set to byte range as parsed from string, but does not include the size information. |

## Constructors

### ByteRange(long start)

    public ByteRange(long start)

Constructor.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `start` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` Start index of blob range to serve. If negative, serve the last abs(start) bytes of the blob. |

### ByteRange(long start, @Nullable Long end)

    protected ByteRange(long start, @Nullable Long end)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `start` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `end` | `https://docs.oracle.com/javase/8/docs/api/java/lang/@org/jspecify/annotations/Nullable Long.html` |

### ByteRange(long start, long end)

    public ByteRange(long start, long end)

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `start` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` Start index of blob range to serve. May not be negative. |
| `end` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` End index of blob range to serve. Index is inclusive, meaning the byte indicated by end is included in the response. |

## Methods

### equals(@Nullable Object object)

    public boolean equals(@Nullable Object object)

Two `ByteRange` objects are considered equal if they have the same start and end.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `object` | `https://docs.oracle.com/javase/8/docs/api/java/lang/@org/jspecify/annotations/Nullable Object.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

**Overrides** [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)

### getEnd()

    public long getEnd()

Get end index of byte range.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | End index of byte range. |

### getStart()

    public long getStart()

Get start index of byte range.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Start index of byte range. |

### hasEnd()

    public boolean hasEnd()

Indicates whether or not this byte range indicates an end.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | true if byte range has an end. |

### hashCode()

    public int hashCode()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

**Overrides** [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)

### toString()

    public String toString()

Format byte range for use in header.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

**Overrides** [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--)