Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- getBuffer()
- getBufferIndex()
- getBufferSize()
- getLine()
- getColumn()
- peek()
- peek(int)
- read()
- skip(long)
- findOffset(char)
- findOffset(int, char)
- skipOrThrow(long)
- ready()
- markSupported()
- mark(int)
- isMarked()
- mark()
- unmark()
- getMarkDistance()
- cloneMark()
- reset()
- close()
- closeAndTakeBuffer()
- peekFor(char)
- tryConsume(char)
- tryConsumeString(String)
- tryConsume(String)
- tryConsume(String, int)
- tryConsumeSome(String, int)
- expect(char)
- expect(String, int)
- tryConsumeOrExpect(char, char)
- consumeWhiteSpace()
- consumeIgnoreCase(String, int)
- readString()
- readRemainingString()
- skipString()
- skipRemainingString()
- readStringPartAsLong(int)
- readBooleanValue()
- skipBooleanValue()
- readNullValue()
- skipNullValue()
- readDoubleValue()
- skipDoubleValue()
- readFloatValue()
- skipFloatValue()
- readLongValue()
- readLongValue(int)
- skipLongValue()
- skipLongValue(int)
- readIntValue()
- readIntValue(int)
- readByteValue()
- readByteValue(int)
- skipIntValue()
- skipIntValue(int)
- skipObject()
- skipObjectContinued()
- skipArray()
- skipArrayContinued()
- skipValue()
- toString()
- fromRawString(String)
- fromJsonString(String)
- fromPath(Path, char[])
- fromBuffer(char[])
- equalsIgnoreCase(char, char)
- readBsonDocument(RawJsonReader)
- readBsonArray(RawJsonReader)
- readBsonValue(RawJsonReader)
- seekToKey(RawJsonReader, String)
- seekToKeyFromObjectStart(RawJsonReader, String, String)
- seekToKeyFromObjectContinued(RawJsonReader, String, String)
- validateBsonDocument(RawJsonReader)
- validateBsonArray(RawJsonReader)
- validateBsonValue(RawJsonReader)
- readSync(Path, Codec, HytaleLogger)
- readSyncWithBak(Path, Codec, HytaleLogger)
Class RawJsonReader
java.lang.Object
com.hypixel.hytale.codec.util.RawJsonReader
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final ThreadLocal<char[]> -
Constructor Summary
ConstructorsConstructorDescriptionRawJsonReader(char[] preFilledBuffer) RawJsonReader(Reader in, char[] buffer) -
Method Summary
Modifier and TypeMethodDescriptionchar[]voidclose()char[]voidconsumeIgnoreCase(String str, int start) voidstatic booleanequalsIgnoreCase(char c1, char c2) voidexpect(char expect) voidintfindOffset(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.static org.bson.BsonDocumentreadBsonDocument(RawJsonReader reader) Deprecated.static org.bson.BsonValuereadBsonValue(RawJsonReader reader) Deprecated.bytebytereadByteValue(int radix) doublefloatintintreadIntValue(int radix) longlongreadLongValue(int radix) longreadStringPartAsLong(int count) static <T> TreadSync(Path path, Codec<T> codec, HytaleLogger logger) static <T> TreadSyncWithBak(Path path, Codec<T> codec, HytaleLogger logger) Reads and decodes a file synchronously with automatic backup file fallback.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) voidunmark()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:
-
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() -
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
-
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
-
toString
-
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
-
readBsonArray
@Deprecated public static org.bson.BsonArray readBsonArray(@Nonnull RawJsonReader reader) throws IOException Deprecated.- 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 HytaleLogger logger) throws IOException - Throws:
IOException
-
readSyncWithBak
@Nullable public static <T> T readSyncWithBak(@Nonnull Path path, @Nonnull Codec<T> codec, @Nonnull HytaleLogger logger) Reads and decodes a file synchronously with automatic backup file fallback.If the primary file is missing, empty, or fails to load, attempts to load from a backup file with the same name plus ".bak" extension. Logs a warning if the backup is used.
- Type Parameters:
T- The type to decode- Parameters:
path- The path to the file to readcodec- The codec to use for decodinglogger- The logger to use for validation errors and warnings- Returns:
- The decoded value, or null if both primary and backup files fail
-