- java.lang.Object
-
- org.redkale.convert.Writer
-
- org.redkale.convert.json.JsonWriter
-
- org.redkale.convert.json.JsonBytesWriter
-
- 所有已实现的接口:
ByteTuple
public class JsonBytesWriter extends JsonWriter implements ByteTuple
writeTo系列的方法输出的字符不能含特殊字符详情见: https://redkale.org
- 从以下版本开始:
- 2.3.0
- 作者:
- zhangjx
-
-
字段概要
-
从类继承的字段 org.redkale.convert.json.JsonWriter
BYTE_COLON, BYTE_COMMA, BYTE_DQUOTE, BYTE_LBRACE, BYTE_LBRACKET, BYTE_RBRACE, BYTE_RBRACKET, DEFAULT_SIZE
-
从类继承的字段 org.redkale.convert.Writer
comma, features, mapFieldFunc, objExtFunc, objFieldFunc, specificObjectType
-
-
构造器概要
构造器 构造器 说明 JsonBytesWriter()
JsonBytesWriter(int size)
JsonBytesWriter(int features, ByteArray array)
JsonBytesWriter(ByteArray array)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 JsonBytesWriter
clear()
void
completed(ConvertBytesHandler handler, Consumer<JsonBytesWriter> callback)
byte[]
content()
int
count()
byte[]
directBytes()
直接获取全部数据, 实际数据需要根据count长度来截取void
directTo(ByteArray array)
将本对象的内容引用复制给arrayprotected byte[]
expand(int len)
int
length()
int
offset()
boolean
recycle()
byte[]
toBytes()
String
toString()
void
writeBoolean(boolean value)
写入一个boolean值void
writeField(EnMember member, String fieldName, Type fieldType, int fieldPos)
输出一个字段名void
writeFieldIntValue(byte[] fieldBytes, char[] fieldChars, int value)
void
writeFieldLatin1Value(byte[] fieldBytes, char[] fieldChars, String value)
void
writeFieldLongValue(byte[] fieldBytes, char[] fieldChars, long value)
void
writeFieldShortValue(byte[] fieldBytes, char[] fieldChars, short value)
void
writeInt(int value)
写入一个int值void
writeLastFieldIntValue(byte[] fieldBytes, char[] fieldChars, int value)
void
writeLastFieldLatin1Value(byte[] fieldBytes, char[] fieldChars, String value)
void
writeLastFieldLongValue(byte[] fieldBytes, char[] fieldChars, long value)
void
writeLastFieldShortValue(byte[] fieldBytes, char[] fieldChars, short value)
void
writeLatin1To(boolean quote, String value)
注意: 该String值不能为null且不会进行转义, 只用于不含需要转义字符的字符串,例如enum、double、BigInteger、BigDecimal转换的Stringvoid
writeLong(long value)
写入一个long值void
writeNull()
输出null值void
writeObjectByOnlyOneLatin1FieldValue(byte[] firstFieldBytes, char[] firstFieldChars, String value)
void
writeObjectByOnlyTwoIntFieldValue(byte[] firstFieldBytes, char[] firstFieldChars, int value1, byte[] lastFieldBytes, char[] lastFieldChars, int value2)
void
writeString(boolean quote, String value)
void
writeString(String value)
写入一个String值void
writeTo(byte ch)
void
writeTo(byte[] chs, int start, int len)
void
writeTo(char ch)
void
writeTo(char[] chs, int start, int len)
void
writeWrapper(StringWrapper wrapper)
写入一个StringConvertWrapper值-
从类继承的方法 org.redkale.convert.json.JsonWriter
charsMode, isExtFuncEmpty, withFeatures, writeArrayB, writeArrayE, writeArrayMark, writeByte, writeByteArray, writeChar, writeDouble, writeField, writeFloat, writeMapB, writeMapE, writeMapMark, writeObjectB, writeObjectE, writeShort, writeStandardString, writeTo, writeTo
-
从类继承的方法 org.redkale.convert.Writer
getFeatures, nullable, specificObjectType, specificObjectType, tiny, writeField, writeObjectField, writeObjectField, writeObjectNull
-
-
-
-
方法详细资料
-
expand
protected byte[] expand(int len)
-
directTo
public void directTo(ByteArray array)
将本对象的内容引用复制给array- 参数:
array
- ByteArray
-
writeNull
public void writeNull()
从类复制的说明:Writer
输出null值- 覆盖:
writeNull
在类中JsonWriter
-
writeField
public final void writeField(EnMember member, String fieldName, Type fieldType, int fieldPos)
从类复制的说明:Writer
输出一个字段名- 覆盖:
writeField
在类中JsonWriter
- 参数:
member
- EnMemberfieldName
- 字段名称fieldType
- 字段类型fieldPos
- 字段顺序
-
writeTo
public void writeTo(char ch)
- 指定者:
writeTo
在类中JsonWriter
-
writeTo
public void writeTo(char[] chs, int start, int len)
- 指定者:
writeTo
在类中JsonWriter
-
writeTo
public void writeTo(byte ch)
- 指定者:
writeTo
在类中JsonWriter
-
writeTo
public void writeTo(byte[] chs, int start, int len)
- 指定者:
writeTo
在类中JsonWriter
-
writeLatin1To
public void writeLatin1To(boolean quote, String value)
注意: 该String值不能为null且不会进行转义, 只用于不含需要转义字符的字符串,例如enum、double、BigInteger、BigDecimal转换的String- 指定者:
writeLatin1To
在类中JsonWriter
- 参数:
quote
- 是否加双引号value
- 非null且不含需要转义的字符的String值
-
writeFieldShortValue
public void writeFieldShortValue(byte[] fieldBytes, char[] fieldChars, short value)
- 指定者:
writeFieldShortValue
在类中JsonWriter
-
writeFieldIntValue
public void writeFieldIntValue(byte[] fieldBytes, char[] fieldChars, int value)
- 指定者:
writeFieldIntValue
在类中JsonWriter
-
writeFieldLongValue
public void writeFieldLongValue(byte[] fieldBytes, char[] fieldChars, long value)
- 指定者:
writeFieldLongValue
在类中JsonWriter
-
writeFieldLatin1Value
public void writeFieldLatin1Value(byte[] fieldBytes, char[] fieldChars, String value)
- 指定者:
writeFieldLatin1Value
在类中JsonWriter
-
writeLastFieldShortValue
public void writeLastFieldShortValue(byte[] fieldBytes, char[] fieldChars, short value)
- 指定者:
writeLastFieldShortValue
在类中JsonWriter
-
writeLastFieldIntValue
public void writeLastFieldIntValue(byte[] fieldBytes, char[] fieldChars, int value)
- 指定者:
writeLastFieldIntValue
在类中JsonWriter
-
writeLastFieldLongValue
public void writeLastFieldLongValue(byte[] fieldBytes, char[] fieldChars, long value)
- 指定者:
writeLastFieldLongValue
在类中JsonWriter
-
writeLastFieldLatin1Value
public void writeLastFieldLatin1Value(byte[] fieldBytes, char[] fieldChars, String value)
- 指定者:
writeLastFieldLatin1Value
在类中JsonWriter
-
writeObjectByOnlyOneLatin1FieldValue
public void writeObjectByOnlyOneLatin1FieldValue(byte[] firstFieldBytes, char[] firstFieldChars, String value)
-
writeObjectByOnlyTwoIntFieldValue
public void writeObjectByOnlyTwoIntFieldValue(byte[] firstFieldBytes, char[] firstFieldChars, int value1, byte[] lastFieldBytes, char[] lastFieldChars, int value2)
-
clear
public JsonBytesWriter clear()
-
directBytes
public byte[] directBytes()
直接获取全部数据, 实际数据需要根据count长度来截取- 返回:
- byte[]
-
completed
public void completed(ConvertBytesHandler handler, Consumer<JsonBytesWriter> callback)
-
toBytes
public byte[] toBytes()
-
count
public int count()
-
writeString
public void writeString(String value)
从类复制的说明:Writer
写入一个String值- 指定者:
writeString
在类中JsonWriter
- 参数:
value
- String值
-
writeString
public void writeString(boolean quote, String value)
- 指定者:
writeString
在类中JsonWriter
-
writeWrapper
public void writeWrapper(StringWrapper wrapper)
从类复制的说明:Writer
写入一个StringConvertWrapper值- 指定者:
writeWrapper
在类中Writer
- 参数:
wrapper
- StringConvertWrapper值
-
writeBoolean
public void writeBoolean(boolean value)
从类复制的说明:Writer
写入一个boolean值- 指定者:
writeBoolean
在类中JsonWriter
- 参数:
value
- boolean值
-
writeInt
public void writeInt(int value)
从类复制的说明:Writer
写入一个int值- 指定者:
writeInt
在类中JsonWriter
- 参数:
value
- int值
-
writeLong
public void writeLong(long value)
从类复制的说明:Writer
写入一个long值- 指定者:
writeLong
在类中JsonWriter
- 参数:
value
- long值
-
-