Package org.apache.johnzon.core
Class JsonStreamParserImpl
- java.lang.Object
-
- org.apache.johnzon.core.JohnzonJsonParserImpl
-
- org.apache.johnzon.core.JsonStreamParserImpl
-
- All Implemented Interfaces:
jakarta.json.stream.JsonParser
,Closeable
,AutoCloseable
,JohnzonJsonParser
,JsonChars
- Direct Known Subclasses:
CommentsJsonStreamParserImpl
public class JsonStreamParserImpl extends JohnzonJsonParserImpl implements JsonChars
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
JsonStreamParserImpl.Buffer
private static class
JsonStreamParserImpl.StructureElement
-
Nested classes/interfaces inherited from interface org.apache.johnzon.core.JohnzonJsonParser
JohnzonJsonParser.JohnzonJsonParserWrapper
-
-
Field Summary
Fields Modifier and Type Field Description private int
arrayDepth
private boolean
autoAdjust
private int
availableCharsInBuffer
private char[]
buffer
private int
bufferLeft
private int
bufferPos
private BufferStrategy.BufferProvider<char[]>
bufferProvider
private boolean
closed
private int
currentIntegralNumber
private long
currentLine
private JsonStreamParserImpl.StructureElement
currentStructureElement
private int
endOfValueInBuffer
private char[]
fallBackCopyBuffer
private int
fallBackCopyBufferLength
private Reader
in
private boolean
isCurrentNumberIntegral
private long
lastLineBreakPosition
private int
maxValueLength
private int
objectDepth
private long
pastBufferReadCount
private byte
previousEvent
private List<JsonStreamParserImpl.Buffer>
previousFallBackCopyBuffers
private boolean
releaseFallBackCopyBuffer
private int
startOfValueInBuffer
private BufferStrategy.BufferProvider<char[]>
valueProvider
-
Fields inherited from interface org.apache.johnzon.core.JsonChars
BACKSPACE, COMMA_CHAR, COMMA_EVENT, CR, DOT, END_ARRAY, END_ARRAY_CHAR, END_OBJECT, END_OBJECT_CHAR, EOF, EOL, ESCAPE_CHAR, EVT_MAP, EXP_LOWERCASE, EXP_UPPERCASE, FALSE_A, FALSE_E, FALSE_F, FALSE_L, FALSE_S, FORMFEED, KEY_NAME, KEY_SEPARATOR, KEY_SEPARATOR_EVENT, MINUS, NINE, NULL, NULL_L, NULL_N, NULL_U, PLUS, QUOTE_CHAR, SPACE, START_ARRAY, START_ARRAY_CHAR, START_OBJECT, START_OBJECT_CHAR, TAB, TRUE_E, TRUE_R, TRUE_T, TRUE_U, VALUE_FALSE, VALUE_NULL, VALUE_NUMBER, VALUE_STRING, VALUE_TRUE, ZERO
-
-
Constructor Summary
Constructors Modifier Constructor Description JsonStreamParserImpl(InputStream inputStream, int maxStringLength, BufferStrategy.BufferProvider<char[]> bufferProvider, BufferStrategy.BufferProvider<char[]> valueBuffer, boolean autoAdjust, JsonProviderImpl provider)
private
JsonStreamParserImpl(InputStream inputStream, Reader reader, Charset encoding, int maxStringLength, BufferStrategy.BufferProvider<char[]> bufferProvider, BufferStrategy.BufferProvider<char[]> valueBuffer, boolean autoAdjust, JsonProviderImpl provider)
JsonStreamParserImpl(InputStream inputStream, Charset encoding, int maxStringLength, BufferStrategy.BufferProvider<char[]> bufferProvider, BufferStrategy.BufferProvider<char[]> valueBuffer, boolean autoAdjust, JsonProviderImpl provider)
JsonStreamParserImpl(Reader reader, int maxStringLength, BufferStrategy.BufferProvider<char[]> bufferProvider, BufferStrategy.BufferProvider<char[]> valueBuffer, boolean autoAdjust, JsonProviderImpl provider)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
appendToCopyBuffer(char c)
void
close()
private void
combinePreviousFallbackBuffersToCurrent()
private void
copyCurrentValue()
private jakarta.json.stream.JsonLocation
createLocation()
private void
createNewFallBackCopyBuffer()
jakarta.json.stream.JsonParser.Event
current()
jakarta.json.stream.JsonParser.Event
currentEvent()
private jakarta.json.stream.JsonParsingException
cust(String message)
protected jakarta.json.stream.JsonParser.Event
defaultHandling(char c)
BigDecimal
getBigDecimal()
protected BufferStrategy.BufferProvider<char[]>
getCharArrayProvider()
int
getInt()
jakarta.json.stream.JsonLocation
getLocation()
long
getLong()
String
getString()
private jakarta.json.stream.JsonParser.Event
handleEndArray()
private jakarta.json.stream.JsonParser.Event
handleEndObject()
private jakarta.json.stream.JsonParser.Event
handleLiteral()
private jakarta.json.stream.JsonParser.Event
handleQuote()
private jakarta.json.stream.JsonParser.Event
handleStartArray()
private jakarta.json.stream.JsonParser.Event
handleStartObject()
boolean
hasNext()
protected jakarta.json.stream.JsonParser.Event
internalNext()
private static boolean
isAsciiDigit(char value)
boolean
isFitLong()
protected boolean
isInArray()
protected boolean
isInObject()
boolean
isIntegralNumber()
boolean
isNotTooLong()
private int
parseHexDigit(char value)
private static Integer
parseIntegerFromChars(char[] chars, int start, int end)
private static Long
parseLongFromChars(char[] chars, int start, int end)
private char
parseUnicodeHexChars()
protected char
readNextChar()
protected char
readNextNonWhitespaceChar(char c)
private void
readNumber()
private void
readString()
private void
releasePreviousFallBackCopyBuffers()
private jakarta.json.stream.JsonParsingException
tmc()
private jakarta.json.stream.JsonParsingException
uexc(char c, String message)
private jakarta.json.stream.JsonParsingException
uexc(String message)
private jakarta.json.stream.JsonParsingException
uexio(IOException e)
private void
unreadChar()
-
Methods inherited from class org.apache.johnzon.core.JohnzonJsonParserImpl
getArray, getArrayStream, getObject, getObjectStream, getValue, getValueStream, next, skipArray, skipObject
-
-
-
-
Field Detail
-
autoAdjust
private final boolean autoAdjust
-
buffer
private final char[] buffer
-
bufferPos
private int bufferPos
-
bufferLeft
private int bufferLeft
-
availableCharsInBuffer
private int availableCharsInBuffer
-
startOfValueInBuffer
private int startOfValueInBuffer
-
endOfValueInBuffer
private int endOfValueInBuffer
-
in
private final Reader in
-
bufferProvider
private final BufferStrategy.BufferProvider<char[]> bufferProvider
-
valueProvider
private final BufferStrategy.BufferProvider<char[]> valueProvider
-
maxValueLength
private final int maxValueLength
-
previousEvent
private byte previousEvent
-
fallBackCopyBuffer
private char[] fallBackCopyBuffer
-
releaseFallBackCopyBuffer
private boolean releaseFallBackCopyBuffer
-
fallBackCopyBufferLength
private int fallBackCopyBufferLength
-
previousFallBackCopyBuffers
private List<JsonStreamParserImpl.Buffer> previousFallBackCopyBuffers
-
currentLine
private long currentLine
-
lastLineBreakPosition
private long lastLineBreakPosition
-
pastBufferReadCount
private long pastBufferReadCount
-
isCurrentNumberIntegral
private boolean isCurrentNumberIntegral
-
currentIntegralNumber
private int currentIntegralNumber
-
currentStructureElement
private JsonStreamParserImpl.StructureElement currentStructureElement
-
arrayDepth
private int arrayDepth
-
objectDepth
private int objectDepth
-
closed
private boolean closed
-
-
Constructor Detail
-
JsonStreamParserImpl
public JsonStreamParserImpl(InputStream inputStream, int maxStringLength, BufferStrategy.BufferProvider<char[]> bufferProvider, BufferStrategy.BufferProvider<char[]> valueBuffer, boolean autoAdjust, JsonProviderImpl provider)
-
JsonStreamParserImpl
public JsonStreamParserImpl(InputStream inputStream, Charset encoding, int maxStringLength, BufferStrategy.BufferProvider<char[]> bufferProvider, BufferStrategy.BufferProvider<char[]> valueBuffer, boolean autoAdjust, JsonProviderImpl provider)
-
JsonStreamParserImpl
public JsonStreamParserImpl(Reader reader, int maxStringLength, BufferStrategy.BufferProvider<char[]> bufferProvider, BufferStrategy.BufferProvider<char[]> valueBuffer, boolean autoAdjust, JsonProviderImpl provider)
-
JsonStreamParserImpl
private JsonStreamParserImpl(InputStream inputStream, Reader reader, Charset encoding, int maxStringLength, BufferStrategy.BufferProvider<char[]> bufferProvider, BufferStrategy.BufferProvider<char[]> valueBuffer, boolean autoAdjust, JsonProviderImpl provider)
-
-
Method Detail
-
appendToCopyBuffer
private void appendToCopyBuffer(char c)
-
copyCurrentValue
private void copyCurrentValue()
-
createNewFallBackCopyBuffer
private void createNewFallBackCopyBuffer()
-
releasePreviousFallBackCopyBuffers
private void releasePreviousFallBackCopyBuffers()
-
hasNext
public final boolean hasNext()
- Specified by:
hasNext
in interfacejakarta.json.stream.JsonParser
-
isAsciiDigit
private static boolean isAsciiDigit(char value)
-
parseHexDigit
private int parseHexDigit(char value)
-
createLocation
private jakarta.json.stream.JsonLocation createLocation()
-
readNextChar
protected final char readNextChar()
-
readNextNonWhitespaceChar
protected final char readNextNonWhitespaceChar(char c)
-
currentEvent
public jakarta.json.stream.JsonParser.Event currentEvent()
- Specified by:
currentEvent
in interfacejakarta.json.stream.JsonParser
-
current
public jakarta.json.stream.JsonParser.Event current()
- Specified by:
current
in interfaceJohnzonJsonParser
- Returns:
- the _current_ Event. That's the one returned by the previous call to
JsonParser.next()
but without propagating the Event pointer to the next entry.
-
unreadChar
private void unreadChar()
-
internalNext
protected final jakarta.json.stream.JsonParser.Event internalNext()
- Specified by:
internalNext
in classJohnzonJsonParserImpl
-
defaultHandling
protected jakarta.json.stream.JsonParser.Event defaultHandling(char c)
-
handleStartObject
private jakarta.json.stream.JsonParser.Event handleStartObject()
-
handleEndObject
private jakarta.json.stream.JsonParser.Event handleEndObject()
-
handleStartArray
private jakarta.json.stream.JsonParser.Event handleStartArray()
-
handleEndArray
private jakarta.json.stream.JsonParser.Event handleEndArray()
-
isInArray
protected boolean isInArray()
- Specified by:
isInArray
in classJohnzonJsonParserImpl
- Returns:
true
if we are currently inside an array
-
isInObject
protected boolean isInObject()
- Specified by:
isInObject
in classJohnzonJsonParserImpl
- Returns:
true
if we are currently inside an object
-
getCharArrayProvider
protected BufferStrategy.BufferProvider<char[]> getCharArrayProvider()
- Specified by:
getCharArrayProvider
in classJohnzonJsonParserImpl
-
readString
private void readString()
-
parseUnicodeHexChars
private char parseUnicodeHexChars()
-
handleQuote
private jakarta.json.stream.JsonParser.Event handleQuote()
-
readNumber
private void readNumber()
-
handleLiteral
private jakarta.json.stream.JsonParser.Event handleLiteral()
-
getString
public String getString()
- Specified by:
getString
in interfacejakarta.json.stream.JsonParser
-
combinePreviousFallbackBuffersToCurrent
private void combinePreviousFallbackBuffersToCurrent()
-
isIntegralNumber
public boolean isIntegralNumber()
- Specified by:
isIntegralNumber
in interfacejakarta.json.stream.JsonParser
-
isNotTooLong
public boolean isNotTooLong()
- Specified by:
isNotTooLong
in interfaceJohnzonJsonParser
-
getInt
public int getInt()
- Specified by:
getInt
in interfacejakarta.json.stream.JsonParser
-
getLong
public long getLong()
- Specified by:
getLong
in interfacejakarta.json.stream.JsonParser
-
isFitLong
public boolean isFitLong()
- Specified by:
isFitLong
in interfaceJohnzonJsonParser
-
getBigDecimal
public BigDecimal getBigDecimal()
- Specified by:
getBigDecimal
in interfacejakarta.json.stream.JsonParser
-
getLocation
public jakarta.json.stream.JsonLocation getLocation()
- Specified by:
getLocation
in interfacejakarta.json.stream.JsonParser
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfacejakarta.json.stream.JsonParser
-
parseLongFromChars
private static Long parseLongFromChars(char[] chars, int start, int end)
-
parseIntegerFromChars
private static Integer parseIntegerFromChars(char[] chars, int start, int end)
-
uexc
private jakarta.json.stream.JsonParsingException uexc(char c, String message)
-
uexc
private jakarta.json.stream.JsonParsingException uexc(String message)
-
tmc
private jakarta.json.stream.JsonParsingException tmc()
-
uexio
private jakarta.json.stream.JsonParsingException uexio(IOException e)
-
cust
private jakarta.json.stream.JsonParsingException cust(String message)
-
-