Top Description Inners Fields Constructors Methods
io.undertow.util

public Class ByteRange

extends Object
Class Inheritance
Imports
io.undertow.UndertowLogger, java.util.ArrayList, .Date, .List

Represents a byte range for a range request
Author
Stuart Douglas

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Field Summary

Modifier and TypeField and Description
private final List<ByteRange.Range>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

The range end
getEnd
(int
The range segment to get
range
)

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

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

Returns a representation of the range result.

public long

Returns:

The range start
getStart
(int
The range segment to get
range
)

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

public static ByteRange

Returns:

A range spec, or null if the range header could not be parsed
parse
(String
The range spec
rangeHeader
)

Attempts to parse a range request.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

rangesback to summary
private final List<ByteRange.Range> ranges

Constructor Detail

ByteRangeback to summary
public ByteRange(List<ByteRange.Range> ranges)

Method Detail

getEndback to summary
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:int

The range segment to get

Returns:long

The range end

getRangesback to summary
public int getRanges()
getResponseResultback to summary
public ByteRange.RangeResponseResult getResponseResult(final 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

getStartback to summary
public long getStart(int range)

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

Parameters
range:int

The range segment to get

Returns:long

The range start

parseback to summary
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:String

The range spec

Returns:ByteRange

A range spec, or null if the range header could not be parsed

io.undertow.util back to summary

public Class ByteRange.Range

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final long
private final long

Constructor Summary

AccessConstructor and Description
public
Range(long start, long end)

Method Summary

Modifier and TypeMethod and Description
public long
public long
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

endback to summary
private final long end
startback to summary
private final long start

Constructor Detail

Rangeback to summary
public Range(long start, long end)

Method Detail

getEndback to summary
public long getEnd()
getStartback to summary
public long getStart()
io.undertow.util back to summary

public Class ByteRange.RangeResponseResult

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final long
private final String
private final long
private final long
private final int

Constructor Summary

AccessConstructor and Description
public
RangeResponseResult(long start, long end, long contentLength, String contentRange, int statusCode)

Method Summary

Modifier and TypeMethod and Description
public long
public String
public long
public long
public int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentLengthback to summary
private final long contentLength
contentRangeback to summary
private final String contentRange
endback to summary
private final long end
startback to summary
private final long start
statusCodeback to summary
private final int statusCode

Constructor Detail

RangeResponseResultback to summary
public RangeResponseResult(long start, long end, long contentLength, String contentRange, int statusCode)

Method Detail

getContentLengthback to summary
public long getContentLength()
getContentRangeback to summary
public String getContentRange()
getEndback to summary
public long getEnd()
getStartback to summary
public long getStart()
getStatusCodeback to summary
public int getStatusCode()