# Class ContentRange

java.lang.Object
org.apache.tomcat.util.http.parser.ContentRange

public class ContentRange extends Object
Represents a parsed Content-Range HTTP header value as defined by RFC 9110.

## Constructor Summary

Constructors
Constructor
Description
`ContentRange(String units, long start, long end, long length)`
Creates a new ContentRange with the specified values.

## Method Summary

Modifier and Type
Method
Description
`long`
`getEnd()`
Returns the end position of the content range.
`long`
`getLength()`
Returns the total length of the resource.
`long`
`getStart()`
Returns the start position of the content range.
`String`
`getUnits()`
Returns the range units (e.g., "bytes") in lower case.
`boolean`
`isValid()`
Validates this content range according to RFC 9110 section 14.4.
`static ContentRange`
`parse(StringReader input)`
Parses a Content-Range header from an HTTP header.

### Methods inherited from class Object

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

## Constructor Details

### ContentRange

public ContentRange(String units, long start, long end, long length)
Creates a new ContentRange with the specified values.

Parameters:
  `units` - the range units (e.g., "bytes"), lowercased
  `start` - the start position of the range
  `end` - the end position of the range
  `length` - the total length of the resource

## Method Details

### getUnits

public String getUnits()
Returns the range units (e.g., "bytes") in lower case.

Returns:
  the range units, or `null` if not set

### getStart

public long getStart()
Returns the start position of the content range.

Returns:
  the start position

### getEnd

public long getEnd()
Returns the end position of the content range.

Returns:
  the end position

### getLength

public long getLength()
Returns the total length of the resource.

Returns:
  the total resource length

### parse

public static ContentRange parse(StringReader input) throws IOException
Parses a Content-Range header from an HTTP header.

Parameters:
  `input` - a reader over the header text
Returns:
  the range parsed from the input, or null if not valid
Throws:
  `IOException` - if there was a problem reading the input

### isValid

public boolean isValid()
Validates this content range according to RFC 9110 section 14.4.

Returns:
  `true` if start >= 0, end >= start, and length > end