public static Map<String, QualityValue> getStringQualityValues(String header)
   {
      if (header == null)
         return null;
      header = header.trim();
      if (header.length() == 0)
         return null;
      Map<String, QualityValue> result = new LinkedHashMap<String, QualityValue>();

      int offset = 0;
      while (true)
      {
         int endIndex = header.indexOf(',', offset);
         String content;
         if (endIndex < 0)
            content = header.substring(offset);
         else
            content = header.substring(offset, endIndex);

         QualityValue qualityValue = QualityValue.DEFAULT;
         int qualityIndex = content.indexOf(';');
         if (qualityIndex >= 0)
         {
            String parameter = content.substring(qualityIndex + 1);
            content = content.substring(0, qualityIndex);

            int equalsIndex = parameter.indexOf('=');
            if (equalsIndex < 0)
               throw new IllegalArgumentException("Malformed parameter: " + parameter);
            String name = parameter.substring(0, equalsIndex).trim();
            if (!"q".equals(name))
               throw new IllegalArgumentException("Unsupported parameter: " + name);
            String value = parameter.substring(equalsIndex + 1).trim();
            qualityValue = QualityValue.valueOf(value);
         }

         content = content.trim();
         if (content.length() == 0)
            throw new IllegalArgumentException("Empty field in: " + header + ".");
         if (content.equals("*"))
            result.put(null, qualityValue);
         else
            result.put(content, qualityValue);

         if (endIndex < 0)
            break;
         offset = endIndex + 1;
      }
      ;

      if (logger.isDebugEnabled())
         logger.debug(result.toString());
      return result;
   }
public static Map < String , QualityValue > getStringQualityValues ( String header ) { if ( header == null ) return null ; header = header . trim ( ) ; if ( header . length ( ) == 0 ) return null ; Map < String , QualityValue > result = new LinkedHashMap < String , QualityValue > ( ) ; int offset = 0 ; while ( true ) { int endIndex = header . indexOf ( ',' , offset ) ; String content ; if ( endIndex < 0 ) content = header . substring ( offset ) ; else content = header . substring ( offset , endIndex ) ; QualityValue qualityValue = QualityValue . DEFAULT ; int qualityIndex = content . indexOf ( ';' ) ; if ( qualityIndex >= 0 ) { String parameter = content . substring ( qualityIndex + 1 ) ; content = content . substring ( 0 , qualityIndex ) ; int equalsIndex = parameter . indexOf ( '=' ) ; if ( equalsIndex < 0 ) throw new IllegalArgumentException ( "Malformed parameter: " + parameter ) ; String name = parameter . substring ( 0 , equalsIndex ) . trim ( ) ; if ( ! "q" . equals ( name ) ) throw new IllegalArgumentException ( "Unsupported parameter: " + name ) ; String value = parameter . substring ( equalsIndex + 1 ) . trim ( ) ; qualityValue = QualityValue . valueOf ( value ) ; } content = content . trim ( ) ; if ( content . length ( ) == 0 ) throw new IllegalArgumentException ( "Empty field in: " + header + "." ) ; if ( content . equals ( "*" ) ) result . put ( null , qualityValue ) ; else result . put ( content , qualityValue ) ; if ( endIndex < 0 ) break ; offset = endIndex + 1 ; } ; if ( logger . isDebugEnabled ( ) ) logger . debug ( result . toString ( ) ) ; return result ; }
Gets the strings from a comma-separated list.
All "*" entries are replaced with {@code null} keys.

@param header the header value.
@return the listed items in order of appearance or {@code null} if the header didn't contain any entries.