Package com.hypixel.hytale.codec.util
Class RawJsonReader
java.lang.Object
com.hypixel.hytale.codec.util.RawJsonReader
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate char[]static final intprivate intprivate intstatic final intstatic final intprivate Readerprivate intprivate intprivate intprivate intprivate intstatic final intstatic final ThreadLocal<char[]> private intprivate StringBuilderprivate static final int -
Constructor Summary
ConstructorsConstructorDescriptionRawJsonReader(char[] preFilledBuffer) RawJsonReader(Reader in, char[] buffer) -
Method Summary
Modifier and TypeMethodDescriptionprivate intappendLine(StringBuilder sb, int index, int lineNumber) private intappendProblemLine(StringBuilder sb, int index, int lineNumber) char[]voidclose()char[]voidconsumeIgnoreCase(String str, int start) voidprivate booleanensure()private booleanensure(int n) static booleanequalsIgnoreCase(char c1, char c2) voidexpect(char expect) voidprivate IOExceptionexpecting(char read, char expect) private IOExceptionprivate IOExceptionprivate IOExceptionexpectingWhile(char read, String expected, String reason) private booleanfill()private intfindLineStart(int index) intfindOffset(char value) intfindOffset(int start, char value) static RawJsonReaderfromBuffer(char[] buffer) static RawJsonReaderfromJsonString(String str) static RawJsonReaderstatic RawJsonReaderfromRawString(String str) char[]intintintintgetLine()intbooleanisMarked()voidmark()voidmark(int readAheadLimit) booleanintpeek()intpeek(int n) booleanpeekFor(char consume) intread()booleanstatic org.bson.BsonArrayreadBsonArray(RawJsonReader reader) Deprecated.private static voidreadBsonArray0(RawJsonReader reader, StringBuilder sb) static org.bson.BsonDocumentreadBsonDocument(RawJsonReader reader) Deprecated.private static voidreadBsonDocument0(RawJsonReader reader, StringBuilder sb) static org.bson.BsonValuereadBsonValue(RawJsonReader reader) Deprecated.bytebytereadByteValue(int radix) doublefloatintintreadIntValue(int radix) longlongreadLongValue(int radix) longreadStringPartAsLong(int count) protected longreadStringPartAsLongSlow(int count) protected longreadStringPartAsLongUnsafe(int count) static <T> Tstatic <T> TreadSyncWithBak(Path path, Codec<T> codec, com.hypixel.hytale.logger.HytaleLogger logger) booleanready()voidreset()static booleanseekToKey(RawJsonReader reader, String search) static StringseekToKeyFromObjectContinued(RawJsonReader reader, String search1, String search2) static StringseekToKeyFromObjectStart(RawJsonReader reader, String search1, String search2) longskip(long skip) voidvoidvoidvoidvoidvoidvoidskipIntValue(int radix) voidvoidskipLongValue(int radix) voidvoidvoidvoidskipOrThrow(long n) voidvoidvoidtoString()booleantryConsume(char consume) booleantryConsume(String str) booleantryConsume(String str, int start) booleantryConsumeOrExpect(char consume, char expect) inttryConsumeSome(String str, int start) booleantryConsumeString(String str) private IOExceptionunexpectedChar(char read) private IOExceptionvoidunmark()static voidvalidateBsonArray(RawJsonReader reader) static voidvalidateBsonDocument(RawJsonReader reader) static voidvalidateBsonValue(RawJsonReader reader)
-
Field Details
-
READ_BUFFER
-
DEFAULT_CHAR_BUFFER_SIZE
public static final int DEFAULT_CHAR_BUFFER_SIZE- See Also:
-
MIN_CHAR_BUFFER_READ
public static final int MIN_CHAR_BUFFER_READ- See Also:
-
BUFFER_GROWTH
public static final int BUFFER_GROWTH- See Also:
-
UNMARKED
private static final int UNMARKED- See Also:
-
streamIndex
private int streamIndex -
in
-
buffer
@Nullable private char[] buffer -
bufferIndex
private int bufferIndex -
bufferSize
private int bufferSize -
markIndex
private int markIndex -
markLine
private int markLine -
markLineStart
private int markLineStart -
tempSb
-
line
private int line -
lineStart
private int lineStart -
ERROR_LINES_BUFFER
public static final int ERROR_LINES_BUFFER- See Also:
-
-
Constructor Details
-
RawJsonReader
public RawJsonReader(@Nonnull char[] preFilledBuffer) -
RawJsonReader
-
-
Method Details
-
getBuffer
public char[] getBuffer() -
getBufferIndex
public int getBufferIndex() -
getBufferSize
public int getBufferSize() -
getLine
public int getLine() -
getColumn
public int getColumn() -
ensure
- Throws:
IOException
-
ensure
- Throws:
IOException
-
fill
- Throws:
IOException
-
peek
- Throws:
IOException
-
peek
- Throws:
IOException
-
read
- Throws:
IOException
-
skip
- Throws:
IOException
-
findOffset
- Throws:
IOException
-
findOffset
- Throws:
IOException
-
skipOrThrow
- Throws:
IOException
-
ready
- Throws:
IOException
-
markSupported
public boolean markSupported() -
mark
- Throws:
IOException
-
isMarked
public boolean isMarked() -
mark
- Throws:
IOException
-
unmark
public void unmark() -
getMarkDistance
public int getMarkDistance() -
cloneMark
public char[] cloneMark() -
reset
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
closeAndTakeBuffer
- Throws:
IOException
-
peekFor
- Throws:
IOException
-
tryConsume
- Throws:
IOException
-
tryConsumeString
- Throws:
IOException
-
tryConsume
- Throws:
IOException
-
tryConsume
- Throws:
IOException
-
tryConsumeSome
- Throws:
IOException
-
expect
- Throws:
IOException
-
expect
- Throws:
IOException
-
tryConsumeOrExpect
- Throws:
IOException
-
consumeWhiteSpace
- Throws:
IOException
-
consumeIgnoreCase
- Throws:
IOException
-
readString
- Throws:
IOException
-
readRemainingString
- Throws:
IOException
-
skipString
- Throws:
IOException
-
skipRemainingString
- Throws:
IOException
-
readStringPartAsLong
- Throws:
IOException
-
readStringPartAsLongSlow
- Throws:
IOException
-
readStringPartAsLongUnsafe
- Throws:
IOException
-
readBooleanValue
- Throws:
IOException
-
skipBooleanValue
- Throws:
IOException
-
readNullValue
- Throws:
IOException
-
skipNullValue
- Throws:
IOException
-
readDoubleValue
- Throws:
IOException
-
skipDoubleValue
- Throws:
IOException
-
readFloatValue
- Throws:
IOException
-
skipFloatValue
- Throws:
IOException
-
readLongValue
- Throws:
IOException
-
readLongValue
- Throws:
IOException
-
skipLongValue
- Throws:
IOException
-
skipLongValue
- Throws:
IOException
-
readIntValue
- Throws:
IOException
-
readIntValue
- Throws:
IOException
-
readByteValue
- Throws:
IOException
-
readByteValue
- Throws:
IOException
-
skipIntValue
- Throws:
IOException
-
skipIntValue
- Throws:
IOException
-
skipObject
- Throws:
IOException
-
skipObjectContinued
- Throws:
IOException
-
skipArray
- Throws:
IOException
-
skipArrayContinued
- Throws:
IOException
-
skipValue
- Throws:
IOException
-
unexpectedEOF
-
unexpectedChar
-
expecting
-
expecting
-
expectingWhile
-
expecting
-
toString
-
findLineStart
private int findLineStart(int index) -
appendLine
-
appendProblemLine
-
fromRawString
-
fromJsonString
-
fromPath
@Nonnull public static RawJsonReader fromPath(@Nonnull Path path, @Nonnull char[] buffer) throws IOException - Throws:
IOException
-
fromBuffer
-
equalsIgnoreCase
public static boolean equalsIgnoreCase(char c1, char c2) -
readBsonDocument
@Deprecated public static org.bson.BsonDocument readBsonDocument(@Nonnull RawJsonReader reader) throws IOException Deprecated.- Throws:
IOException
-
readBsonDocument0
private static void readBsonDocument0(@Nonnull RawJsonReader reader, @Nonnull StringBuilder sb) throws IOException - Throws:
IOException
-
readBsonArray
@Deprecated public static org.bson.BsonArray readBsonArray(@Nonnull RawJsonReader reader) throws IOException Deprecated.- Throws:
IOException
-
readBsonArray0
private static void readBsonArray0(@Nonnull RawJsonReader reader, @Nonnull StringBuilder sb) throws IOException - Throws:
IOException
-
readBsonValue
@Deprecated public static org.bson.BsonValue readBsonValue(@Nonnull RawJsonReader reader) throws IOException Deprecated.- Throws:
IOException
-
seekToKey
public static boolean seekToKey(@Nonnull RawJsonReader reader, @Nonnull String search) throws IOException - Throws:
IOException
-
seekToKeyFromObjectStart
@Nullable public static String seekToKeyFromObjectStart(@Nonnull RawJsonReader reader, @Nonnull String search1, @Nonnull String search2) throws IOException - Throws:
IOException
-
seekToKeyFromObjectContinued
@Nullable public static String seekToKeyFromObjectContinued(@Nonnull RawJsonReader reader, @Nonnull String search1, @Nonnull String search2) throws IOException - Throws:
IOException
-
validateBsonDocument
- Throws:
IOException
-
validateBsonArray
- Throws:
IOException
-
validateBsonValue
- Throws:
IOException
-
readSync
@Nullable public static <T> T readSync(@Nonnull Path path, @Nonnull Codec<T> codec, @Nonnull com.hypixel.hytale.logger.HytaleLogger logger) throws IOException - Throws:
IOException
-
readSyncWithBak
-