@Test public void testNameValueListParseBasics() { ByteSequence buf = ContentUtil.encode( "test; test1 = stuff ; test2 = \"stuff; stuff\"; test3=\"stuff"); ParserCursor cursor = new ParserCursor(0, buf.length()); List<NameValuePair> params = parser.parseParameters(buf, cursor); org.junit.Assert.assertEquals("test", params.get(0).getName()); org.junit.Assert.assertEquals(null, params.get(0).getValue()); org.junit.Assert.assertEquals("test1", params.get(1).getName()); org.junit.Assert.assertEquals("stuff", params.get(1).getValue()); org.junit.Assert.assertEquals("test2", params.get(2).getName()); org.junit.Assert.assertEquals("stuff; stuff", params.get(2).getValue()); org.junit.Assert.assertEquals("test3", params.get(3).getName()); org.junit.Assert.assertEquals("stuff", params.get(3).getValue()); org.junit.Assert.assertEquals(buf.length(), cursor.getPos()); org.junit.Assert.assertTrue(cursor.atEnd()); }
public List<NameValuePair> parseParameters(final ByteSequence buf, final ParserCursor cursor) { List<NameValuePair> params = new ArrayList<NameValuePair>(); skipWhiteSpace(buf, cursor); while (!cursor.atEnd()) { NameValuePair param = parseParameter(buf, cursor); params.add(param); } return params; }
RawFieldParser { public List<NameValuePair> parseParameters(final ByteSequence buf, final ParserCursor cursor) { List<NameValuePair> params = new ArrayList<NameValuePair>(); skipWhiteSpace(buf, cursor); while (!cursor.atEnd()) { NameValuePair param = parseParameter(buf, cursor); params.add(param); } return params; } }
RawFieldParser { public List<NameValuePair> parseParameters(final ByteSequence buf, final ParserCursor cursor) { List<NameValuePair> params = new ArrayList<NameValuePair>(); skipWhiteSpace(buf, cursor); while (!cursor.atEnd()) { NameValuePair param = parseParameter(buf, cursor); params.add(param); } return params; }  }
RawFieldParser { public List<NameValuePair> parseParameters(final ByteSequence buf, final ParserCursor cursor) { List<NameValuePair> params = new ArrayList<NameValuePair>(); skipWhiteSpace(buf, cursor); while (!cursor.atEnd()) { NameValuePair param = parseParameter(buf, cursor); params.add(param); } return params; }  static BitSet INIT_BITSET(int ... b); RawField parseField(final ByteSequence raw); RawBody parseRawBody(final RawField field); RawBody parseRawBody(final ByteSequence buf, final ParserCursor cursor); List<NameValuePair> parseParameters(final ByteSequence buf, final ParserCursor cursor); NameValuePair parseParameter(final ByteSequence buf, final ParserCursor cursor); String parseToken(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters); String parseValue(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters); void skipWhiteSpace(final ByteSequence buf, final ParserCursor cursor); void skipComment(final ByteSequence buf, final ParserCursor cursor); void skipAllWhiteSpace(final ByteSequence buf, final ParserCursor cursor); void copyContent(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters,
            final StringBuilder dst); void copyUnquotedContent(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters,
                            final StringBuilder dst); void copyQuotedContent(final ByteSequence buf, final ParserCursor cursor,
            final StringBuilder dst); }
RawFieldParser { public List<NameValuePair> parseParameters(final ByteSequence buf, final ParserCursor cursor) { List<NameValuePair> params = new ArrayList<NameValuePair>(); skipWhiteSpace(buf, cursor); while (!cursor.atEnd()) { NameValuePair param = parseParameter(buf, cursor); params.add(param); } return params; }  static BitSet INIT_BITSET(int ... b); RawField parseField(final ByteSequence raw); RawBody parseRawBody(final RawField field); RawBody parseRawBody(final ByteSequence buf, final ParserCursor cursor); List<NameValuePair> parseParameters(final ByteSequence buf, final ParserCursor cursor); NameValuePair parseParameter(final ByteSequence buf, final ParserCursor cursor); String parseToken(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters); String parseValue(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters); void skipWhiteSpace(final ByteSequence buf, final ParserCursor cursor); void skipComment(final ByteSequence buf, final ParserCursor cursor); void skipAllWhiteSpace(final ByteSequence buf, final ParserCursor cursor); void copyContent(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters,
            final StringBuilder dst); void copyUnquotedContent(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters,
                            final StringBuilder dst); void copyQuotedContent(final ByteSequence buf, final ParserCursor cursor,
            final StringBuilder dst); static final RawFieldParser DEFAULT; }