1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.fourthline.cling.model.message.header;
17
18 import org.fourthline.cling.model.types.BytesRange;
19 import org.fourthline.cling.model.types.InvalidValueException;
20
21
22
23
24
25
26 public class ContentRangeHeader extends UpnpHeader<BytesRange> {
27
28 public static final String PREFIX = "bytes ";
29
30 public ContentRangeHeader() {
31 }
32
33 public ContentRangeHeader(BytesRange value) {
34 setValue(value);
35 }
36
37 public ContentRangeHeader(String s) {
38 setString(s);
39 }
40
41 public void setString(String s) throws InvalidHeaderException {
42 try {
43 setValue(BytesRange.valueOf(s,PREFIX));
44 } catch (InvalidValueException invalidValueException) {
45 throw new InvalidHeaderException("Invalid Range Header: " + invalidValueException.getMessage());
46 }
47 }
48
49 public String getString() {
50 return getValue().getString(true,PREFIX);
51 }
52 }