@Test void testGetCSV() { HttpFields fields = new HttpFields(); fields.put("name0", "value0A,value0B"); fields.add("name0", "value0C,value0D"); fields.put("name1", "value1A, \"value\t, 1B\" "); fields.add("name1", "\"value1C\",\tvalue1D"); Enumeration<String> e = fields.getValues("name0"); assertTrue(e.hasMoreElements()); assertEquals(e.nextElement(), "value0A,value0B"); assertTrue(e.hasMoreElements()); assertEquals(e.nextElement(), "value0C,value0D"); assertFalse(e.hasMoreElements()); e = Collections.enumeration(fields.getCSV("name0", false)); assertTrue(e.hasMoreElements()); assertEquals(e.nextElement(), "value0A"); assertTrue(e.hasMoreElements()); assertEquals(e.nextElement(), "value0B"); assertTrue(e.hasMoreElements()); assertEquals(e.nextElement(), "value0C"); assertTrue(e.hasMoreElements()); assertEquals(e.nextElement(), "value0D"); assertFalse(e.hasMoreElements()); e = Collections.enumeration(fields.getCSV("name1", false)); assertTrue(e.hasMoreElements()); assertEquals(e.nextElement(), "value1A"); assertTrue(e.hasMoreElements()); assertEquals(e.nextElement(), "value\t, 1B"); assertTrue(e.hasMoreElements()); assertEquals(e.nextElement(), "value1C"); assertTrue(e.hasMoreElements()); assertEquals(e.nextElement(), "value1D"); assertFalse(e.hasMoreElements()); }
public List<String> getCSV(HttpHeader header, boolean keepQuotes) { QuotedCSV values = null; for (HttpField f : this) { if (f.getHeader() == header) { if (values == null) values = new QuotedCSV(keepQuotes); values.addValue(f.getValue()); } } return values == null ? Collections.emptyList() : values.getValues(); }
HttpFields implements Iterable<HttpField> { public List<String> getCSV(HttpHeader header, boolean keepQuotes) { QuotedCSV values = null; for (HttpField f : this) { if (f.getHeader() == header) { if (values == null) values = new QuotedCSV(keepQuotes); values.addValue(f.getValue()); } } return values == null ? Collections.emptyList() : values.getValues(); } }
HttpFields implements Iterable<HttpField> { public List<String> getCSV(HttpHeader header, boolean keepQuotes) { QuotedCSV values = null; for (HttpField f : this) { if (f.getHeader() == header) { if (values == null) values = new QuotedCSV(keepQuotes); values.addValue(f.getValue()); } } return values == null ? Collections.emptyList() : values.getValues(); } HttpFields();  HttpFields(int capacity);  HttpFields(HttpFields fields); }
HttpFields implements Iterable<HttpField> { public List<String> getCSV(HttpHeader header, boolean keepQuotes) { QuotedCSV values = null; for (HttpField f : this) { if (f.getHeader() == header) { if (values == null) values = new QuotedCSV(keepQuotes); values.addValue(f.getValue()); } } return values == null ? Collections.emptyList() : values.getValues(); } HttpFields();  HttpFields(int capacity);  HttpFields(HttpFields fields); static String stripParameters(String value); static String valueParameters(String value, Map<String, String> parameters); int size(); @Override Iterator<HttpField> iterator(); Stream<HttpField> stream(); Set<String> getFieldNamesCollection(); Enumeration<String> getFieldNames(); HttpField getField(int index); HttpField getField(HttpHeader header); HttpField getField(String name); boolean contains(HttpField field); boolean contains(HttpHeader header, String value); boolean contains(String name, String value); boolean contains(HttpHeader header); boolean containsKey(String name); @Deprecated String getStringField(HttpHeader header); String get(HttpHeader header); @Deprecated String getStringField(String name); String get(String header); List<String> getValuesList(HttpHeader header); List<String> getValuesList(String name); boolean addCSV(HttpHeader header, String... values); boolean addCSV(String name, String... values); List<String> getCSV(HttpHeader header, boolean keepQuotes); List<String> getCSV(String name, boolean keepQuotes); List<String> getQualityCSV(HttpHeader header); List<String> getQualityCSV(String name); Enumeration<String> getValues(final String name); void put(HttpField field); void put(String name, String value); void put(HttpHeader header, HttpHeaderValue value); void put(HttpHeader header, String value); void put(String name, List<String> list); void add(String name, String value); void add(HttpHeader header, HttpHeaderValue value); void add(HttpHeader header, String value); HttpField remove(HttpHeader name); HttpField remove(String name); long getLongField(String name); long getDateField(String name); void putLongField(HttpHeader name, long value); void putLongField(String name, long value); void putDateField(HttpHeader name, long date); void putDateField(String name, long date); void addDateField(String name, long date); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); void clear(); void add(HttpField field); void addAll(HttpFields fields); void add(HttpFields fields); }
HttpFields implements Iterable<HttpField> { public List<String> getCSV(HttpHeader header, boolean keepQuotes) { QuotedCSV values = null; for (HttpField f : this) { if (f.getHeader() == header) { if (values == null) values = new QuotedCSV(keepQuotes); values.addValue(f.getValue()); } } return values == null ? Collections.emptyList() : values.getValues(); } HttpFields();  HttpFields(int capacity);  HttpFields(HttpFields fields); static String stripParameters(String value); static String valueParameters(String value, Map<String, String> parameters); int size(); @Override Iterator<HttpField> iterator(); Stream<HttpField> stream(); Set<String> getFieldNamesCollection(); Enumeration<String> getFieldNames(); HttpField getField(int index); HttpField getField(HttpHeader header); HttpField getField(String name); boolean contains(HttpField field); boolean contains(HttpHeader header, String value); boolean contains(String name, String value); boolean contains(HttpHeader header); boolean containsKey(String name); @Deprecated String getStringField(HttpHeader header); String get(HttpHeader header); @Deprecated String getStringField(String name); String get(String header); List<String> getValuesList(HttpHeader header); List<String> getValuesList(String name); boolean addCSV(HttpHeader header, String... values); boolean addCSV(String name, String... values); List<String> getCSV(HttpHeader header, boolean keepQuotes); List<String> getCSV(String name, boolean keepQuotes); List<String> getQualityCSV(HttpHeader header); List<String> getQualityCSV(String name); Enumeration<String> getValues(final String name); void put(HttpField field); void put(String name, String value); void put(HttpHeader header, HttpHeaderValue value); void put(HttpHeader header, String value); void put(String name, List<String> list); void add(String name, String value); void add(HttpHeader header, HttpHeaderValue value); void add(HttpHeader header, String value); HttpField remove(HttpHeader name); HttpField remove(String name); long getLongField(String name); long getDateField(String name); void putLongField(HttpHeader name, long value); void putLongField(String name, long value); void putDateField(HttpHeader name, long date); void putDateField(String name, long date); void addDateField(String name, long date); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); void clear(); void add(HttpField field); void addAll(HttpFields fields); void add(HttpFields fields);  }