Class QuotedQualityCSV

  • All Implemented Interfaces:
    Iterable<String>

    public class QuotedQualityCSV
    extends QuotedCSV
    implements Iterable<String>
    Implements a quoted comma separated list of quality values in accordance with RFC7230 and RFC7231. Values are returned sorted in quality order, with OWS and the quality parameters removed.
    See Also:
    "https://tools.ietf.org/html/rfc7230#section-3.2.6", "https://tools.ietf.org/html/rfc7230#section-7", "https://tools.ietf.org/html/rfc7231#section-5.3.1"
    • Field Detail

      • MOST_SPECIFIC

        public static Function<String,​Integer> MOST_SPECIFIC
        Function to apply a most specific MIME encoding secondary ordering
    • Constructor Detail

      • QuotedQualityCSV

        public QuotedQualityCSV()
        Sorts values with equal quality according to the length of the value String.
      • QuotedQualityCSV

        public QuotedQualityCSV​(String[] preferredOrder)
        Sorts values with equal quality according to given order.
        Parameters:
        preferredOrder - Array indicating the preferred order of known values
      • QuotedQualityCSV

        public QuotedQualityCSV​(Function<String,​Integer> secondaryOrdering)
        Orders values with equal quality with the given function.
        Parameters:
        secondaryOrdering - Function to apply an ordering other than specified by quality
    • Method Detail

      • parsedValue

        protected void parsedValue​(StringBuffer buffer)
        Description copied from class: QuotedCSV
        Called when a value has been parsed
        Overrides:
        parsedValue in class QuotedCSV
        Parameters:
        buffer - Containing the trimmed value, which may be mutated
      • parsedParam

        protected void parsedParam​(StringBuffer buffer,
                                   int valueLength,
                                   int paramName,
                                   int paramValue)
        Description copied from class: QuotedCSV
        Called when a parameter has been parsed
        Overrides:
        parsedParam in class QuotedCSV
        Parameters:
        buffer - Containing the trimmed value and all parameters, which may be mutated
        valueLength - The length of the value
        paramName - The index of the start of the parameter just parsed
        paramValue - The index of the start of the parameter value just parsed, or -1
      • sort

        protected void sort()