Class QuotedQualityCSV

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.String>

    public class QuotedQualityCSV
    extends QuotedCSV
    implements java.lang.Iterable<java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      static java.util.function.ToIntFunction<java.lang.String> MOST_SPECIFIC_MIME_ORDERING
      Lambda to apply a most specific MIME encoding secondary ordering.
    • Constructor Summary

      Constructors 
      Constructor Description
      QuotedQualityCSV()
      Sorts values with equal quality according to the length of the value String.
      QuotedQualityCSV​(java.lang.String[] preferredOrder)
      Sorts values with equal quality according to given order.
      QuotedQualityCSV​(java.util.function.ToIntFunction<java.lang.String> secondaryOrdering)
      Orders values with equal quality with the given function.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.String> getValues()  
      java.util.Iterator<java.lang.String> iterator()  
      protected void parsedParam​(java.lang.StringBuffer buffer, int valueLength, int paramName, int paramValue)
      Called when a parameter has been parsed
      protected void parsedValue​(java.lang.StringBuffer buffer)
      Called when a value has been parsed (prior to any parameters)
      protected void parsedValueAndParams​(java.lang.StringBuffer buffer)
      Called when a value and it's parameters has been parsed
      protected void sort()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • MOST_SPECIFIC_MIME_ORDERING

        public static java.util.function.ToIntFunction<java.lang.String> MOST_SPECIFIC_MIME_ORDERING
        Lambda to apply a most specific MIME encoding secondary ordering.
        See Also:
        "https://tools.ietf.org/html/rfc7231#section-5.3.2"
    • Constructor Detail

      • QuotedQualityCSV

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

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

        public QuotedQualityCSV​(java.util.function.ToIntFunction<java.lang.String> secondaryOrdering)
        Orders values with equal quality with the given function.
        Parameters:
        secondaryOrdering - Function to apply an ordering other than specified by quality, highest values are sorted first.
    • Method Detail

      • parsedValueAndParams

        protected void parsedValueAndParams​(java.lang.StringBuffer buffer)
        Description copied from class: QuotedCSVParser
        Called when a value and it's parameters has been parsed
        Overrides:
        parsedValueAndParams in class QuotedCSV
        Parameters:
        buffer - Containing the trimmed value and parameters
      • parsedValue

        protected void parsedValue​(java.lang.StringBuffer buffer)
        Description copied from class: QuotedCSVParser
        Called when a value has been parsed (prior to any parameters)
        Overrides:
        parsedValue in class QuotedCSVParser
        Parameters:
        buffer - Containing the trimmed value, which may be mutated
      • parsedParam

        protected void parsedParam​(java.lang.StringBuffer buffer,
                                   int valueLength,
                                   int paramName,
                                   int paramValue)
        Description copied from class: QuotedCSVParser
        Called when a parameter has been parsed
        Overrides:
        parsedParam in class QuotedCSVParser
        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
      • getValues

        public java.util.List<java.lang.String> getValues()
        Overrides:
        getValues in class QuotedCSV
      • iterator

        public java.util.Iterator<java.lang.String> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.String>
        Overrides:
        iterator in class QuotedCSV
      • sort

        protected void sort()