Package org.apache.flink.types.parser
Class StringValueParser
- java.lang.Object
-
- org.apache.flink.types.parser.FieldParser<StringValue>
-
- org.apache.flink.types.parser.StringValueParser
-
@PublicEvolving public class StringValueParser extends FieldParser<StringValue>
Converts a variable length field of a byte array into aStringValue. 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.- See Also:
StringValue
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.types.parser.FieldParser
FieldParser.ParseErrorState
-
-
Constructor Summary
Constructors Constructor Description StringValueParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringValuecreateValue()Returns an instance of the parsed value type.voidenableQuotedStringParsing(byte quoteCharacter)StringValuegetLastResult()Gets the parsed field.intparseField(byte[] bytes, int startPos, int limit, byte[] delimiter, StringValue reusable)Each parser's logic should be implemented inside this method-
Methods inherited from class org.apache.flink.types.parser.FieldParser
delimiterNext, endsWithDelimiter, getCharset, getErrorState, getParserForType, nextStringEndPos, nextStringLength, resetErrorStateAndParse, resetParserState, setCharset, setErrorState
-
-
-
-
Method Detail
-
enableQuotedStringParsing
public void enableQuotedStringParsing(byte quoteCharacter)
-
parseField
public int parseField(byte[] bytes, int startPos, int limit, byte[] delimiter, StringValue reusable)Description copied from class:FieldParserEach parser's logic should be implemented inside this method- Specified by:
parseFieldin classFieldParser<StringValue>
-
createValue
public StringValue createValue()
Description copied from class:FieldParserReturns an instance of the parsed value type.- Specified by:
createValuein classFieldParser<StringValue>- Returns:
- An instance of the parsed value type.
-
getLastResult
public StringValue getLastResult()
Description copied from class:FieldParserGets the parsed field. This method returns the value parsed by the last successful invocation ofFieldParser.parseField(byte[], int, int, byte[], Object). It objects are mutable and reused, it will return the object instance that was passed the parse function.- Specified by:
getLastResultin classFieldParser<StringValue>- Returns:
- The latest parsed field.
-
-