- java.lang.Object
-
- org.redkale.convert.Writer
-
- org.redkale.convert.json.JsonWriter
-
public abstract class JsonWriter extends Writer
writeTo系列的方法输出的字符不能含特殊字符详情见: https://redkale.org
- 作者:
- zhangjx
-
-
字段概要
字段 修饰符和类型 字段 说明 protected static byte
BYTE_COLON
protected static byte
BYTE_COMMA
protected static byte
BYTE_DQUOTE
protected static byte
BYTE_LBRACE
protected static byte
BYTE_LBRACKET
protected static byte
BYTE_RBRACE
protected static byte
BYTE_RBRACKET
protected static int
DEFAULT_SIZE
-
从类继承的字段 org.redkale.convert.Writer
comma, features, mapFieldFunc, objExtFunc, objFieldFunc, specificObjectType
-
-
构造器概要
构造器 限定符 构造器 说明 protected
JsonWriter()
-
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 boolean
charsMode()
boolean
isExtFuncEmpty()
JsonWriter
withFeatures(int features)
void
writeArrayB(int size, Encodeable componentEncoder, Object obj)
输出一个数组前的操作void
writeArrayE()
输出一个数组后的操作void
writeArrayMark()
输出数组元素间的间隔符abstract void
writeBoolean(boolean value)
写入一个boolean值void
writeByte(byte value)
写入一个byte值void
writeByteArray(byte[] values)
写入byte[]void
writeChar(char value)
写入一个char值void
writeDouble(double value)
写入一个double值void
writeField(byte[] fieldBytes, char[] fieldChars)
void
writeField(EnMember member, String fieldName, Type fieldType, int fieldPos)
输出一个字段名abstract void
writeFieldIntValue(byte[] fieldBytes, char[] fieldChars, int value)
abstract void
writeFieldLatin1Value(byte[] fieldBytes, char[] fieldChars, String value)
abstract void
writeFieldLongValue(byte[] fieldBytes, char[] fieldChars, long value)
abstract void
writeFieldShortValue(byte[] fieldBytes, char[] fieldChars, short value)
void
writeFloat(float value)
写入一个float值abstract void
writeInt(int value)
写入一个int值abstract void
writeLastFieldIntValue(byte[] fieldBytes, char[] fieldChars, int value)
abstract void
writeLastFieldLatin1Value(byte[] fieldBytes, char[] fieldChars, String value)
abstract void
writeLastFieldLongValue(byte[] fieldBytes, char[] fieldChars, long value)
abstract void
writeLastFieldShortValue(byte[] fieldBytes, char[] fieldChars, short value)
abstract void
writeLatin1To(boolean quote, String value)
注意: 该String值不能为null且不会进行转义, 只用于不含需要转义字符的字符串,例如enum、double、BigInteger、BigDecimal转换的Stringabstract void
writeLong(long value)
写入一个long值void
writeMapB(int size, Encodeable keyEncoder, Encodeable valueEncoder, Object obj)
输出一个Map前的操作void
writeMapE()
输出一个Map后的操作void
writeMapMark()
输出一个Map中key与value间的间隔符void
writeNull()
输出null值void
writeObjectB(Object obj)
输出一个对象前的操作 注: 覆盖此方法必须要先调用父方法 super.writeObjectB(obj);abstract void
writeObjectByOnlyOneLatin1FieldValue(byte[] firstFieldBytes, char[] firstFieldChars, String value)
abstract void
writeObjectByOnlyTwoIntFieldValue(byte[] firstFieldBytes, char[] firstFieldChars, int value1, byte[] lastFieldBytes, char[] lastFieldChars, int value2)
void
writeObjectE(Object obj)
输出一个对象后的操作void
writeShort(short value)
写入一个short值void
writeStandardString(String value)
写入无转义字符长度不超过255的字符串, 例如枚举值、字段名、类名字符串等 *abstract void
writeString(boolean quote, String value)
abstract void
writeString(String value)
写入一个String值abstract void
writeTo(byte ch)
void
writeTo(byte[] chs)
abstract void
writeTo(byte[] chs, int start, int len)
abstract void
writeTo(char ch)
void
writeTo(char... chs)
abstract void
writeTo(char[] chs, int start, int len)
-
从类继承的方法 org.redkale.convert.Writer
getFeatures, nullable, recycle, specificObjectType, specificObjectType, tiny, writeField, writeObjectField, writeObjectField, writeObjectNull, writeWrapper
-
-
-
-
字段详细资料
-
DEFAULT_SIZE
protected static final int DEFAULT_SIZE
-
BYTE_COMMA
protected static final byte BYTE_COMMA
- 另请参阅:
- 常量字段值
-
BYTE_COLON
protected static final byte BYTE_COLON
- 另请参阅:
- 常量字段值
-
BYTE_LBRACE
protected static final byte BYTE_LBRACE
- 另请参阅:
- 常量字段值
-
BYTE_RBRACE
protected static final byte BYTE_RBRACE
- 另请参阅:
- 常量字段值
-
BYTE_LBRACKET
protected static final byte BYTE_LBRACKET
- 另请参阅:
- 常量字段值
-
BYTE_RBRACKET
protected static final byte BYTE_RBRACKET
- 另请参阅:
- 常量字段值
-
BYTE_DQUOTE
protected static final byte BYTE_DQUOTE
- 另请参阅:
- 常量字段值
-
-
方法详细资料
-
withFeatures
public JsonWriter withFeatures(int features)
- 覆盖:
withFeatures
在类中Writer
-
isExtFuncEmpty
@ClassDepends public boolean isExtFuncEmpty()
-
charsMode
public boolean charsMode()
-
writeTo
public abstract void writeTo(char ch)
-
writeTo
public abstract void writeTo(char[] chs, int start, int len)
-
writeTo
public abstract void writeTo(byte ch)
-
writeTo
public abstract void writeTo(byte[] chs, int start, int len)
-
writeLatin1To
@ClassDepends public abstract void writeLatin1To(boolean quote, String value)
注意: 该String值不能为null且不会进行转义, 只用于不含需要转义字符的字符串,例如enum、double、BigInteger、BigDecimal转换的String- 参数:
quote
- 是否加双引号value
- 非null且不含需要转义的字符的String值
-
writeField
@ClassDepends public void writeField(byte[] fieldBytes, char[] fieldChars)
-
writeFieldShortValue
@ClassDepends public abstract void writeFieldShortValue(byte[] fieldBytes, char[] fieldChars, short value)
-
writeFieldIntValue
@ClassDepends public abstract void writeFieldIntValue(byte[] fieldBytes, char[] fieldChars, int value)
-
writeFieldLongValue
@ClassDepends public abstract void writeFieldLongValue(byte[] fieldBytes, char[] fieldChars, long value)
-
writeFieldLatin1Value
@ClassDepends public abstract void writeFieldLatin1Value(byte[] fieldBytes, char[] fieldChars, String value)
-
writeLastFieldShortValue
@ClassDepends public abstract void writeLastFieldShortValue(byte[] fieldBytes, char[] fieldChars, short value)
-
writeLastFieldIntValue
@ClassDepends public abstract void writeLastFieldIntValue(byte[] fieldBytes, char[] fieldChars, int value)
-
writeLastFieldLongValue
@ClassDepends public abstract void writeLastFieldLongValue(byte[] fieldBytes, char[] fieldChars, long value)
-
writeLastFieldLatin1Value
@ClassDepends public abstract void writeLastFieldLatin1Value(byte[] fieldBytes, char[] fieldChars, String value)
-
writeObjectByOnlyOneLatin1FieldValue
@ClassDepends public abstract void writeObjectByOnlyOneLatin1FieldValue(byte[] firstFieldBytes, char[] firstFieldChars, String value)
-
writeObjectByOnlyTwoIntFieldValue
@ClassDepends public abstract void writeObjectByOnlyTwoIntFieldValue(byte[] firstFieldBytes, char[] firstFieldChars, int value1, byte[] lastFieldBytes, char[] lastFieldChars, int value2)
-
writeBoolean
@ClassDepends public abstract void writeBoolean(boolean value)
从类复制的说明:Writer
写入一个boolean值- 指定者:
writeBoolean
在类中Writer
- 参数:
value
- boolean值
-
writeInt
@ClassDepends public abstract void writeInt(int value)
从类复制的说明:Writer
写入一个int值
-
writeLong
@ClassDepends public abstract void writeLong(long value)
从类复制的说明:Writer
写入一个long值
-
writeString
public abstract void writeString(boolean quote, String value)
-
writeString
@ClassDepends public abstract void writeString(String value)
从类复制的说明:Writer
写入一个String值- 指定者:
writeString
在类中Writer
- 参数:
value
- String值
-
writeField
public void writeField(EnMember member, String fieldName, Type fieldType, int fieldPos)
从类复制的说明:Writer
输出一个字段名- 指定者:
writeField
在类中Writer
- 参数:
member
- EnMemberfieldName
- 字段名称fieldType
- 字段类型fieldPos
- 字段顺序
-
writeStandardString
public final void writeStandardString(String value)
从类复制的说明:Writer
写入无转义字符长度不超过255的字符串, 例如枚举值、字段名、类名字符串等 *- 指定者:
writeStandardString
在类中Writer
- 参数:
value
- 非空且不含需要转义的字符的String值
-
writeTo
public final void writeTo(char... chs)
-
writeByte
public final void writeByte(byte value)
从类复制的说明:Writer
写入一个byte值
-
writeTo
public final void writeTo(byte[] chs)
-
writeByteArray
public final void writeByteArray(byte[] values)
从类复制的说明:Writer
写入byte[]- 指定者:
writeByteArray
在类中Writer
- 参数:
values
- byte[]
-
writeChar
public final void writeChar(char value)
从类复制的说明:Writer
写入一个char值
-
writeShort
public final void writeShort(short value)
从类复制的说明:Writer
写入一个short值- 指定者:
writeShort
在类中Writer
- 参数:
value
- short值
-
writeFloat
public final void writeFloat(float value)
从类复制的说明:Writer
写入一个float值- 指定者:
writeFloat
在类中Writer
- 参数:
value
- float值
-
writeDouble
public final void writeDouble(double value)
从类复制的说明:Writer
写入一个double值- 指定者:
writeDouble
在类中Writer
- 参数:
value
- double值
-
writeObjectB
public final void writeObjectB(Object obj)
从类复制的说明:Writer
输出一个对象前的操作 注: 覆盖此方法必须要先调用父方法 super.writeObjectB(obj);- 覆盖:
writeObjectB
在类中Writer
- 参数:
obj
- 写入的对象
-
writeObjectE
public final void writeObjectE(Object obj)
从类复制的说明:Writer
输出一个对象后的操作- 指定者:
writeObjectE
在类中Writer
- 参数:
obj
- 写入的对象
-
writeArrayB
public final void writeArrayB(int size, Encodeable componentEncoder, Object obj)
从类复制的说明:Writer
输出一个数组前的操作- 指定者:
writeArrayB
在类中Writer
- 参数:
size
- 数组长度componentEncoder
- Encodeableobj
- 对象, 不一定是数组、Collection对象,也可能是伪Collection对象
-
writeArrayMark
public final void writeArrayMark()
从类复制的说明:Writer
输出数组元素间的间隔符- 指定者:
writeArrayMark
在类中Writer
-
writeArrayE
public final void writeArrayE()
从类复制的说明:Writer
输出一个数组后的操作- 指定者:
writeArrayE
在类中Writer
-
writeMapB
public final void writeMapB(int size, Encodeable keyEncoder, Encodeable valueEncoder, Object obj)
从类复制的说明:Writer
输出一个Map前的操作
-
writeMapMark
public final void writeMapMark()
从类复制的说明:Writer
输出一个Map中key与value间的间隔符- 指定者:
writeMapMark
在类中Writer
-
-