public static final HeaderElement[] parseElements(final char[] headerValue){
  LOG.trace("enter HeaderElement.parseElements(char[])");
  if (headerValue == null) {
    return new HeaderElement[]{};
  }
  final List elements=new ArrayList();
  int i=0;
  int from=0;
  final int len=headerValue.length;
  boolean qouted=false;
  while (i < len) {
    final char ch=headerValue[i];
    if (ch == '"') {
      qouted=!qouted;
    }
    HeaderElement element=null;
    if ((!qouted) && (ch == ',')) {
      element=new HeaderElement(headerValue,from,i);
      from=i + 1;
    }
 else     if (i == len - 1) {
      element=new HeaderElement(headerValue,from,len);
    }
    if ((element != null) && (element.getName() != null)) {
      elements.add(element);
    }
    i++;
  }
  return (HeaderElement[])elements.toArray(new HeaderElement[elements.size()]);
}

public static final HeaderElement [ ] parseElements ( final char [ ] headerValue ) { LOG . trace ( "enter HeaderElement.parseElements(char[])" ) ; if ( headerValue == null ) { return new HeaderElement [ ] { } ; } final List elements = new ArrayList ( ) ; int i = 0 ; int from = 0 ; final int len = headerValue . length ; boolean qouted = false ; while ( i < len ) { final char ch = headerValue [ i ] ; if ( ch == '"' ) { qouted = ! qouted ; } HeaderElement element = null ; if ( ( ! qouted ) && ( ch == ',' ) ) { element = new HeaderElement ( headerValue , from , i ) ; from = i + 1 ; } else if ( i == len - 1 ) { element = new HeaderElement ( headerValue , from , len ) ; } if ( ( element != null ) && ( element . getName ( ) != null ) ) { elements . add ( element ) ; } i ++ ; } return ( HeaderElement [ ] ) elements . toArray ( new HeaderElement [ elements . size ( ) ] ) ; }
this parses the value part of a header . the result is an array of headerelement objects .
