Package org.nustaq.serialization.coders
Class FSTJsonEncoder
java.lang.Object
org.nustaq.serialization.coders.FSTJsonEncoder
- All Implemented Interfaces:
FSTEncoder
public class FSTJsonEncoder extends java.lang.Object implements FSTEncoder
Created by ruedi on 20/05/15.
-
Field Summary
Fields Modifier and Type Field Description protected com.fasterxml.jackson.core.JsonGeneratorgen -
Constructor Summary
Constructors Constructor Description FSTJsonEncoder(FSTConfiguration conf) -
Method Summary
Modifier and Type Method Description protected java.lang.StringclassToString(java.lang.Class clz)voidclose()close and flush to underlying stream if present.voidcreateGenerator()voidensureFree(int bytes)voidexternalEnd(FSTClazzInfo clz)voidflush()resets stream (positions are lost)byte[]getBuffer()FSTConfigurationgetConf()intgetWritten()booleanisByteArrayBased()booleanisPrimitiveArray(java.lang.Object array, java.lang.Class<?> componentType)booleanisTagMultiDimSubArrays()booleanisWritingAttributes()voidregisterClass(java.lang.Class possible)voidreset(byte[] outbytes)voidsetConf(FSTConfiguration conf)voidsetOutstream(java.io.OutputStream outstream)if output stream is null, just encode into a byte arrayvoidskip(int i)voidwriteArrayEnd()booleanwriteAttributeName(FSTClazzInfo.FSTFieldInfo subInfo, java.lang.Object outerObjectToWrite)voidwriteClass(java.lang.Class cl)voidwriteClass(FSTClazzInfo clInf)voidwriteFByte(int v)voidwriteFChar(char c)voidwriteFDouble(double value)voidwriteFFloat(float value)voidwriteFieldsEnd(FSTClazzInfo serializationInfo)voidwriteFInt(int anInt)voidwriteFLong(long anInt)voidwriteFShort(short c)voidwriteInt32At(int position, int v)used to write uncompressed int (guaranteed length = 4) at a (eventually recent) positionvoidwritePrimitiveArray(java.lang.Object array, int start, int length)does not write class tag and lengthvoidwriteRawBytes(byte[] bufferedName, int off, int length)voidwriteStringUTF(java.lang.String str)booleanwriteTag(byte tag, java.lang.Object infoOrObject, long somValue, java.lang.Object toWrite, FSTObjectOutput oout)voidwriteVersionTag(int version)
-
Field Details
-
gen
protected com.fasterxml.jackson.core.JsonGenerator gen
-
-
Constructor Details
-
Method Details
-
setConf
- Specified by:
setConfin interfaceFSTEncoder
-
writeRawBytes
public void writeRawBytes(byte[] bufferedName, int off, int length) throws java.io.IOException- Specified by:
writeRawBytesin interfaceFSTEncoder- Throws:
java.io.IOException
-
writePrimitiveArray
public void writePrimitiveArray(java.lang.Object array, int start, int length) throws java.io.IOExceptionDescription copied from interface:FSTEncoderdoes not write class tag and length- Specified by:
writePrimitiveArrayin interfaceFSTEncoder- Throws:
java.io.IOException
-
writeStringUTF
public void writeStringUTF(java.lang.String str) throws java.io.IOException- Specified by:
writeStringUTFin interfaceFSTEncoder- Throws:
java.io.IOException
-
writeFShort
public void writeFShort(short c) throws java.io.IOException- Specified by:
writeFShortin interfaceFSTEncoder- Throws:
java.io.IOException
-
writeFChar
public void writeFChar(char c) throws java.io.IOException- Specified by:
writeFCharin interfaceFSTEncoder- Throws:
java.io.IOException
-
writeFByte
public void writeFByte(int v) throws java.io.IOException- Specified by:
writeFBytein interfaceFSTEncoder- Throws:
java.io.IOException
-
writeFInt
public void writeFInt(int anInt) throws java.io.IOException- Specified by:
writeFIntin interfaceFSTEncoder- Throws:
java.io.IOException
-
writeFLong
public void writeFLong(long anInt) throws java.io.IOException- Specified by:
writeFLongin interfaceFSTEncoder- Throws:
java.io.IOException
-
writeFFloat
public void writeFFloat(float value) throws java.io.IOException- Specified by:
writeFFloatin interfaceFSTEncoder- Throws:
java.io.IOException
-
writeFDouble
public void writeFDouble(double value) throws java.io.IOException- Specified by:
writeFDoublein interfaceFSTEncoder- Throws:
java.io.IOException
-
getWritten
public int getWritten()- Specified by:
getWrittenin interfaceFSTEncoder
-
skip
public void skip(int i)- Specified by:
skipin interfaceFSTEncoder
-
close
public void close() throws java.io.IOExceptionDescription copied from interface:FSTEncoderclose and flush to underlying stream if present. The stream is also closed- Specified by:
closein interfaceFSTEncoder- Throws:
java.io.IOException
-
reset
public void reset(byte[] outbytes)- Specified by:
resetin interfaceFSTEncoder
-
flush
public void flush() throws java.io.IOExceptionDescription copied from interface:FSTEncoderresets stream (positions are lost)- Specified by:
flushin interfaceFSTEncoder- Throws:
java.io.IOException
-
writeInt32At
public void writeInt32At(int position, int v)Description copied from interface:FSTEncoderused to write uncompressed int (guaranteed length = 4) at a (eventually recent) position- Specified by:
writeInt32Atin interfaceFSTEncoder
-
setOutstream
public void setOutstream(java.io.OutputStream outstream)Description copied from interface:FSTEncoderif output stream is null, just encode into a byte array- Specified by:
setOutstreamin interfaceFSTEncoder
-
createGenerator
public void createGenerator() throws java.io.IOException- Throws:
java.io.IOException
-
ensureFree
public void ensureFree(int bytes) throws java.io.IOException- Specified by:
ensureFreein interfaceFSTEncoder- Throws:
java.io.IOException
-
getBuffer
public byte[] getBuffer()- Specified by:
getBufferin interfaceFSTEncoder
-
registerClass
public void registerClass(java.lang.Class possible)- Specified by:
registerClassin interfaceFSTEncoder
-
writeClass
public void writeClass(java.lang.Class cl)- Specified by:
writeClassin interfaceFSTEncoder
-
writeClass
- Specified by:
writeClassin interfaceFSTEncoder
-
writeTag
public boolean writeTag(byte tag, java.lang.Object infoOrObject, long somValue, java.lang.Object toWrite, FSTObjectOutput oout) throws java.io.IOException- Specified by:
writeTagin interfaceFSTEncoder- Throws:
java.io.IOException
-
classToString
protected java.lang.String classToString(java.lang.Class clz) -
writeAttributeName
public boolean writeAttributeName(FSTClazzInfo.FSTFieldInfo subInfo, java.lang.Object outerObjectToWrite)- Specified by:
writeAttributeNamein interfaceFSTEncoder
-
externalEnd
- Specified by:
externalEndin interfaceFSTEncoder
-
isWritingAttributes
public boolean isWritingAttributes()- Specified by:
isWritingAttributesin interfaceFSTEncoder
-
isPrimitiveArray
public boolean isPrimitiveArray(java.lang.Object array, java.lang.Class<?> componentType)- Specified by:
isPrimitiveArrayin interfaceFSTEncoder
-
isTagMultiDimSubArrays
public boolean isTagMultiDimSubArrays()- Specified by:
isTagMultiDimSubArraysin interfaceFSTEncoder
-
writeVersionTag
public void writeVersionTag(int version) throws java.io.IOException- Specified by:
writeVersionTagin interfaceFSTEncoder- Throws:
java.io.IOException
-
isByteArrayBased
public boolean isByteArrayBased()- Specified by:
isByteArrayBasedin interfaceFSTEncoder
-
writeArrayEnd
public void writeArrayEnd()- Specified by:
writeArrayEndin interfaceFSTEncoder
-
writeFieldsEnd
- Specified by:
writeFieldsEndin interfaceFSTEncoder
-
getConf
- Specified by:
getConfin interfaceFSTEncoder
-