303 char c = line.charAt(0);
304 if (c == ' ' || c == '\t') {
305 hdr h = headers.get(headers.size() - 1);
306 h.line += "\r\n" + line;
307 } else
308 headers.add(new hdr(line));
309 } catch (StringIndexOutOfBoundsException e) {
310 // line is empty, ignore it
311 return;
312 } catch (NoSuchElementException e) {
313 // XXX - vector is empty?
314 }
315 }
316
317 /**
318 * Return all the header lines as a collection
319 *
320 * @return list of header lines.
321 */
322 public List<String> getAllHeaderLines() {
323 if(headerValueView==null)
324 headerValueView = new AbstractList<String>() {
325 @Override
326 public String get(int index) {
327 return headers.get(index).line;
328 }
329
330 @Override
331 public int size() {
332 return headers.size();
333 }
334 };
335 return headerValueView;
336 }
337 }
338
339 /*
340 * A private utility class to represent an individual header.
341 */
342
343 class hdr implements Header {
|
303 char c = line.charAt(0);
304 if (c == ' ' || c == '\t') {
305 hdr h = headers.get(headers.size() - 1);
306 h.line += "\r\n" + line;
307 } else
308 headers.add(new hdr(line));
309 } catch (StringIndexOutOfBoundsException e) {
310 // line is empty, ignore it
311 return;
312 } catch (NoSuchElementException e) {
313 // XXX - vector is empty?
314 }
315 }
316
317 /**
318 * Return all the header lines as a collection
319 *
320 * @return list of header lines.
321 */
322 public List<String> getAllHeaderLines() {
323 if (headerValueView == null)
324 headerValueView = new AbstractList<String>() {
325 @Override
326 public String get(int index) {
327 return headers.get(index).line;
328 }
329
330 @Override
331 public int size() {
332 return headers.size();
333 }
334 };
335 return headerValueView;
336 }
337 }
338
339 /*
340 * A private utility class to represent an individual header.
341 */
342
343 class hdr implements Header {
|