io.undertow.util

## Class ByteRange

- java.lang.Object
- - io.undertow.util.ByteRange

    public class ByteRange
    extends Object

Represents a byte range for a range request

Author:
  Stuart Douglas

### Nested Class Summary

Nested Classes
`static class` `ByteRange.Range`
`static class` `ByteRange.RangeResponseResult`

### Constructor Summary

Constructors
Constructor and Description
`ByteRange(List<ByteRange.Range> ranges)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`long` `getEnd(int range)` Gets the end of the specified range segment, or the number of bytes if this is a suffix range segment
`int` `getRanges()`
`ByteRange.RangeResponseResult` `getResponseResult(long resourceContentLength, String ifRange, Date lastModified, String eTag)` Returns a representation of the range result.
`long` `getStart(int range)` Gets the start of the specified range segment, of -1 if this is a suffix range segment
`static ByteRange` `parse(String rangeHeader)` Attempts to parse a range request.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ByteRange

    public ByteRange(List<ByteRange.Range> ranges)

### Method Detail

#### getRanges

    public int getRanges()

#### getStart

    public long getStart(int range)

Gets the start of the specified range segment, of -1 if this is a suffix range segment

Parameters:
  `range` - The range segment to get
Returns:
  The range start

#### getEnd

    public long getEnd(int range)

Gets the end of the specified range segment, or the number of bytes if this is a suffix range segment

Parameters:
  `range` - The range segment to get
Returns:
  The range end

#### parse

    public static ByteRange parse(String rangeHeader)

Attempts to parse a range request. If the range request is invalid it will just return null so that it may be ignored.

Parameters:
  `rangeHeader` - The range spec
Returns:
  A range spec, or null if the range header could not be parsed

#### getResponseResult

    public ByteRange.RangeResponseResult getResponseResult(long resourceContentLength,
                                                           String ifRange,
                                                           Date lastModified,
                                                           String eTag)

Returns a representation of the range result. If this returns null then a 200 response should be sent instead

Parameters:
  `resourceContentLength` -
Returns: