Class StringParser


  • @PublicEvolving
    public class StringParser
    extends FieldParser<String>
    Converts a variable length field of a byte array into a String. The byte contents between delimiters is interpreted as an ASCII string. The string may be quoted in double quotes. For quoted strings, whitespaces (space and tab) leading and trailing before and after the quotes are removed.
    • Constructor Detail

      • StringParser

        public StringParser()
    • Method Detail

      • enableQuotedStringParsing

        public void enableQuotedStringParsing​(byte quoteCharacter)
      • parseField

        public int parseField​(byte[] bytes,
                              int startPos,
                              int limit,
                              byte[] delimiter,
                              String reusable)
        Description copied from class: FieldParser
        Each parser's logic should be implemented inside this method
        Specified by:
        parseField in class FieldParser<String>
      • createValue

        public String createValue()
        Description copied from class: FieldParser
        Returns an instance of the parsed value type.
        Specified by:
        createValue in class FieldParser<String>
        Returns:
        An instance of the parsed value type.