public class RangeResource extends Resource
parseRange()
to prepare internal state for rendering.
The method will throw RangeNotSatisfiableException
if the requested
byte ranges cannot be replayed with the base Resource.
RangeResource currently only works with:
Content-Length
, or a valid 206 capture
with single range (i.e. no support for multipart/byteranges
)
HttpHeaderOperation.parseRanges(String)
Constructor and Description |
---|
RangeResource(Resource origResource,
long[][] requestedRanges)
Initialize with base Resource and requested ranges.
|
Modifier and Type | Method and Description |
---|---|
protected long[] |
availableRange()
Look at resource HTTP header fields and determine the byte range available.
|
void |
close() |
Map<String,String> |
getHttpHeaders()
Assumes an HTTP response - return the HTTP headers, not including the
HTTP Message header
|
long |
getRecordLength() |
int |
getStatusCode()
Assumes an HTTP resource - return the HTTP response code
|
void |
parseRange()
Prepare response for requested range.
|
available, getHeader, getRefersToDate, getRefersToTargetURI, mark, markSupported, parseHeaders, read, read, read, reset, setChunkedEncoding, setInputStream, skip
public RangeResource(Resource origResource, long[][] requestedRanges)
origResource
- base resourcerequestedRanges
- requested rangeHttpHeaderOperation.parseRanges(String)
public void parseRange() throws RangeNotSatisfiableException, IOException
RangeNotSatisfiableException
- base Resource either does not have
enough data to fulfill the request, or have invalid header field.IOException
protected long[] availableRange()
null
for multipart/byteranges
response.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Resource
IOException
public Map<String,String> getHttpHeaders()
Resource
getHttpHeaders
in class Resource
public long getRecordLength()
getRecordLength
in class Resource
public int getStatusCode()
Resource
getStatusCode
in class Resource
Copyright © 2005–2017 IIPC. All rights reserved.