83 |
} |
} |
84 |
|
|
85 |
protected int nextLine(String str, int curPos) { |
protected int nextLine(String str, int curPos) { |
86 |
if (curPos >= (str.length() - 2)) return 0; |
if (curPos >= (str.length() - 2)) return str.length(); |
87 |
for(; str.charAt(curPos) != '\r' |
for(; str.charAt(curPos) != '\r' |
88 |
&& str.charAt(curPos + 1) != '\n' |
&& str.charAt(curPos + 1) != '\n' |
89 |
&& curPos != str.length() - 2; |
&& curPos != str.length() - 2; |
92 |
} |
} |
93 |
|
|
94 |
protected int nextHeader(String str, int curPos) { |
protected int nextHeader(String str, int curPos) { |
95 |
if (curPos >= (str.length() - 2)) return 0; |
if (curPos >= (str.length() - 2)) return str.length(); |
96 |
while(str.charAt(curPos) != '\r' |
while(str.charAt(curPos) != '\r' |
97 |
&& str.charAt(curPos + 1) != '\n') { |
&& str.charAt(curPos + 1) != '\n') { |
98 |
curPos = nextLine(str, curPos); |
curPos = nextLine(str, curPos); |
120 |
while(!getFieldBodyString("content-type", |
while(!getFieldBodyString("content-type", |
121 |
header, |
header, |
122 |
position).trim().startsWith("text/") |
position).trim().startsWith("text/") |
123 |
&& position != 0) { |
&& position != header.length()) { |
124 |
oldPosition = position; |
oldPosition = position; |
125 |
position = nextHeader(header, position); |
position = nextHeader(header, position); |
126 |
} |
} |
127 |
String id = getFieldBodyString("content-id", header, oldPosition).trim(); |
String id = getFieldBodyString("content-id", header, oldPosition).trim(); |
128 |
if(id.startsWith("storm:block:")) |
if(id.startsWith("storm:block:")) { |
129 |
id = id.substring("storm:block:".length()); |
id = id.substring("storm:block:".length()); |
130 |
return (new Mediaserver.Id(id)); |
return (new Mediaserver.Id(id)); |
131 |
|
} else { |
132 |
|
return null; |
133 |
|
} |
134 |
} |
} |
135 |
|
|
136 |
protected String getFieldBodyString(String field, |
protected String getFieldBodyString(String field, |
177 |
} |
} |
178 |
} |
} |
179 |
position = nextLine(header, position); |
position = nextLine(header, position); |
180 |
} while(position != 0); |
} while(position != header.length()); |
181 |
return positions; |
return positions; |
182 |
} |
} |
183 |
|
|