- java.lang.Object
-
- org.redkale.convert.Writer
-
- org.redkale.convert.json.JsonWriter
-
- org.redkale.convert.json.JsonByteBufferWriter
-
public class JsonByteBufferWriter extends JsonWriter
以ByteBuffer为数据载体的JsonWriter详情见: https://redkale.org
- 作者:
- zhangjx
-
-
字段概要
字段 修饰符和类型 字段 说明 protected Charset
charset
-
从类继承的字段 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
-
-
构造器概要
构造器 构造器 说明 JsonByteBufferWriter(int features, Charset charset, Supplier<ByteBuffer> supplier)
JsonByteBufferWriter(int features, Supplier<ByteBuffer> supplier)
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 int
count()
protected static int
encodeEscapeUTF8Length(char[] text, int start, int len)
protected boolean
recycle()
ByteBuffer[]
toBuffers()
ByteArray
toByteArray()
String
toString()
void
writeBoolean(boolean value)
写入一个boolean值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
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, writeField, writeFloat, writeMapB, writeMapE, writeMapMark, writeNull, writeObjectB, writeObjectE, writeShort, writeStandardString, writeTo, writeTo
-
从类继承的方法 org.redkale.convert.Writer
getFeatures, nullable, specificObjectType, specificObjectType, tiny, writeField, writeObjectField, writeObjectField, writeObjectNull
-
-
-
-
字段详细资料
-
charset
protected Charset charset
-
-
构造器详细资料
-
JsonByteBufferWriter
public JsonByteBufferWriter(int features, Supplier<ByteBuffer> supplier)
-
JsonByteBufferWriter
public JsonByteBufferWriter(int features, Charset charset, Supplier<ByteBuffer> supplier)
-
-
方法详细资料
-
toBuffers
public ByteBuffer[] toBuffers()
-
toByteArray
public ByteArray toByteArray()
-
count
public int count()
-
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
-
encodeEscapeUTF8Length
protected static int encodeEscapeUTF8Length(char[] text, int start, int len)
-
writeLatin1To
public void writeLatin1To(boolean quote, String value)
注意: 该String值不能为null且不会进行转义, 只用于不含需要转义字符的字符串,例如enum、double、BigInteger、BigDecimal转换的String- 指定者:
writeLatin1To
在类中JsonWriter
- 参数:
quote
- 是否写入双引号value
- 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)
-
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值
-
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值
-
-