Package org.h2.util.json
Class JSONByteArrayTarget
java.lang.Object
org.h2.util.json.JSONTarget<byte[]>
org.h2.util.json.JSONByteArrayTarget
JSON byte array target.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private final ByteArrayOutputStream
private static final byte[]
private boolean
private static final byte[]
private final ByteStack
private static final byte[]
private static final byte[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private void
static ByteArrayOutputStream
encodeString
(ByteArrayOutputStream baos, String s) Encodes a JSON string and appends it to the specified output stream.void
endArray()
End of the current array.void
End of the current object.byte[]
Returns the result.boolean
Returns whether member's name or the end of the current object is expected.boolean
Returns whether value separator expected before the next member or value.void
Name of a member.void
Start of an array.void
Start of an object.void
Parse "false".void
Parse "null".void
valueNumber
(BigDecimal number) A number value.void
valueString
(String string) A string value.void
Parse "true".
-
Field Details
-
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
-
stack
-
needSeparator
private boolean needSeparator -
afterName
private boolean afterName
-
-
Constructor Details
-
JSONByteArrayTarget
public JSONByteArrayTarget()Creates new instance of JSON byte array target.
-
-
Method Details
-
encodeString
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:JSONTarget
Start of an object.- Specified by:
startObject
in classJSONTarget<byte[]>
-
endObject
public void endObject()Description copied from class:JSONTarget
End of the current object.- Specified by:
endObject
in classJSONTarget<byte[]>
-
startArray
public void startArray()Description copied from class:JSONTarget
Start of an array.- Specified by:
startArray
in classJSONTarget<byte[]>
-
endArray
public void endArray()Description copied from class:JSONTarget
End of the current array.- Specified by:
endArray
in classJSONTarget<byte[]>
-
member
Description copied from class:JSONTarget
Name of a member.- Specified by:
member
in classJSONTarget<byte[]>
- Parameters:
name
- the name
-
valueNull
public void valueNull()Description copied from class:JSONTarget
Parse "null".null
value.- Specified by:
valueNull
in classJSONTarget<byte[]>
-
valueFalse
public void valueFalse()Description copied from class:JSONTarget
Parse "false".false
value.- Specified by:
valueFalse
in classJSONTarget<byte[]>
-
valueTrue
public void valueTrue()Description copied from class:JSONTarget
Parse "true".true
value.- Specified by:
valueTrue
in classJSONTarget<byte[]>
-
valueNumber
Description copied from class:JSONTarget
A number value.- Specified by:
valueNumber
in classJSONTarget<byte[]>
- Parameters:
number
- the number
-
valueString
Description copied from class:JSONTarget
A string value.- Specified by:
valueString
in classJSONTarget<byte[]>
- Parameters:
string
- the string
-
beforeValue
private void beforeValue() -
afterValue
private void afterValue() -
isPropertyExpected
public boolean isPropertyExpected()Description copied from class:JSONTarget
Returns whether member's name or the end of the current object is expected.- Specified by:
isPropertyExpected
in classJSONTarget<byte[]>
- Returns:
true
if it is,false
otherwise
-
isValueSeparatorExpected
public boolean isValueSeparatorExpected()Description copied from class:JSONTarget
Returns whether value separator expected before the next member or value.- Specified by:
isValueSeparatorExpected
in classJSONTarget<byte[]>
- Returns:
true
if it is,false
otherwise
-
getResult
public byte[] getResult()Description copied from class:JSONTarget
Returns the result.- Specified by:
getResult
in classJSONTarget<byte[]>
- Returns:
- the result
-