Package org.h2.util.json
Class JSONByteArrayTarget
- java.lang.Object
-
- org.h2.util.json.JSONTarget<byte[]>
-
- org.h2.util.json.JSONByteArrayTarget
-
public final class JSONByteArrayTarget extends JSONTarget<byte[]>
JSON byte array target.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanafterNameprivate java.io.ByteArrayOutputStreambaosprivate static byte[]FALSE_BYTESprivate booleanneedSeparatorprivate static byte[]NULL_BYTESprivate ByteStackstackprivate static byte[]TRUE_BYTESprivate static byte[]U00_BYTES
-
Constructor Summary
Constructors Constructor Description JSONByteArrayTarget()Creates new instance of JSON byte array target.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidafterValue()private voidbeforeValue()static java.io.ByteArrayOutputStreamencodeString(java.io.ByteArrayOutputStream baos, java.lang.String s)Encodes a JSON string and appends it to the specified output stream.voidendArray()End of the current array.voidendObject()End of the current object.byte[]getResult()Returns the result.booleanisPropertyExpected()Returns whether member's name or the end of the current object is expected.booleanisValueSeparatorExpected()Returns whether value separator expected before the next member or value.voidmember(java.lang.String name)Name of a member.voidstartArray()Start of an array.voidstartObject()Start of an object.voidvalueFalse()Parse "false".voidvalueNull()Parse "null".voidvalueNumber(java.math.BigDecimal number)A number value.voidvalueString(java.lang.String string)A string value.voidvalueTrue()Parse "true".
-
-
-
Field Detail
-
NULL_BYTES
private static final byte[] NULL_BYTES
-
FALSE_BYTES
private static final byte[] FALSE_BYTES
-
TRUE_BYTES
private static final byte[] TRUE_BYTES
-
U00_BYTES
private static final byte[] U00_BYTES
-
baos
private final java.io.ByteArrayOutputStream baos
-
stack
private final ByteStack stack
-
needSeparator
private boolean needSeparator
-
afterName
private boolean afterName
-
-
Method Detail
-
encodeString
public static java.io.ByteArrayOutputStream encodeString(java.io.ByteArrayOutputStream baos, java.lang.String s)Encodes a JSON string and appends it to the specified output stream.- Parameters:
baos- the output stream to append tos- the string to encode- Returns:
- the specified output stream
-
startObject
public void startObject()
Description copied from class:JSONTargetStart of an object.- Specified by:
startObjectin classJSONTarget<byte[]>
-
endObject
public void endObject()
Description copied from class:JSONTargetEnd of the current object.- Specified by:
endObjectin classJSONTarget<byte[]>
-
startArray
public void startArray()
Description copied from class:JSONTargetStart of an array.- Specified by:
startArrayin classJSONTarget<byte[]>
-
endArray
public void endArray()
Description copied from class:JSONTargetEnd of the current array.- Specified by:
endArrayin classJSONTarget<byte[]>
-
member
public void member(java.lang.String name)
Description copied from class:JSONTargetName of a member.- Specified by:
memberin classJSONTarget<byte[]>- Parameters:
name- the name
-
valueNull
public void valueNull()
Description copied from class:JSONTargetParse "null".nullvalue.- Specified by:
valueNullin classJSONTarget<byte[]>
-
valueFalse
public void valueFalse()
Description copied from class:JSONTargetParse "false".falsevalue.- Specified by:
valueFalsein classJSONTarget<byte[]>
-
valueTrue
public void valueTrue()
Description copied from class:JSONTargetParse "true".truevalue.- Specified by:
valueTruein classJSONTarget<byte[]>
-
valueNumber
public void valueNumber(java.math.BigDecimal number)
Description copied from class:JSONTargetA number value.- Specified by:
valueNumberin classJSONTarget<byte[]>- Parameters:
number- the number
-
valueString
public void valueString(java.lang.String string)
Description copied from class:JSONTargetA string value.- Specified by:
valueStringin classJSONTarget<byte[]>- Parameters:
string- the string
-
beforeValue
private void beforeValue()
-
afterValue
private void afterValue()
-
isPropertyExpected
public boolean isPropertyExpected()
Description copied from class:JSONTargetReturns whether member's name or the end of the current object is expected.- Specified by:
isPropertyExpectedin classJSONTarget<byte[]>- Returns:
trueif it is,falseotherwise
-
isValueSeparatorExpected
public boolean isValueSeparatorExpected()
Description copied from class:JSONTargetReturns whether value separator expected before the next member or value.- Specified by:
isValueSeparatorExpectedin classJSONTarget<byte[]>- Returns:
trueif it is,falseotherwise
-
getResult
public byte[] getResult()
Description copied from class:JSONTargetReturns the result.- Specified by:
getResultin classJSONTarget<byte[]>- Returns:
- the result
-
-