Package org.nustaq.serialization.coders
Class FSTJsonEncoder
java.lang.Object
org.nustaq.serialization.coders.FSTJsonEncoder
- All Implemented Interfaces:
FSTEncoder
public class FSTJsonEncoder extends 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 StringclassToString(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(Object array, Class<?> componentType)booleanisTagMultiDimSubArrays()booleanisWritingAttributes()voidregisterClass(Class possible)voidreset(byte[] outbytes)voidsetConf(FSTConfiguration conf)voidsetOutstream(OutputStream outstream)if output stream is null, just encode into a byte arrayvoidskip(int i)voidwriteArrayEnd()booleanwriteAttributeName(FSTClazzInfo.FSTFieldInfo subInfo, Object outerObjectToWrite)voidwriteClass(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(Object array, int start, int length)does not write class tag and lengthvoidwriteRawBytes(byte[] bufferedName, int off, int length)voidwriteStringUTF(String str)booleanwriteTag(byte tag, Object infoOrObject, long somValue, 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
- Specified by:
writeRawBytesin interfaceFSTEncoder- Throws:
IOException
-
writePrimitiveArray
Description copied from interface:FSTEncoderdoes not write class tag and length- Specified by:
writePrimitiveArrayin interfaceFSTEncoder- Throws:
IOException
-
writeStringUTF
- Specified by:
writeStringUTFin interfaceFSTEncoder- Throws:
IOException
-
writeFShort
- Specified by:
writeFShortin interfaceFSTEncoder- Throws:
IOException
-
writeFChar
- Specified by:
writeFCharin interfaceFSTEncoder- Throws:
IOException
-
writeFByte
- Specified by:
writeFBytein interfaceFSTEncoder- Throws:
IOException
-
writeFInt
- Specified by:
writeFIntin interfaceFSTEncoder- Throws:
IOException
-
writeFLong
- Specified by:
writeFLongin interfaceFSTEncoder- Throws:
IOException
-
writeFFloat
- Specified by:
writeFFloatin interfaceFSTEncoder- Throws:
IOException
-
writeFDouble
- Specified by:
writeFDoublein interfaceFSTEncoder- Throws:
IOException
-
getWritten
public int getWritten()- Specified by:
getWrittenin interfaceFSTEncoder
-
skip
public void skip(int i)- Specified by:
skipin interfaceFSTEncoder
-
close
Description copied from interface:FSTEncoderclose and flush to underlying stream if present. The stream is also closed- Specified by:
closein interfaceFSTEncoder- Throws:
IOException
-
reset
public void reset(byte[] outbytes)- Specified by:
resetin interfaceFSTEncoder
-
flush
Description copied from interface:FSTEncoderresets stream (positions are lost)- Specified by:
flushin interfaceFSTEncoder- Throws:
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
Description copied from interface:FSTEncoderif output stream is null, just encode into a byte array- Specified by:
setOutstreamin interfaceFSTEncoder
-
createGenerator
- Throws:
IOException
-
ensureFree
- Specified by:
ensureFreein interfaceFSTEncoder- Throws:
IOException
-
getBuffer
public byte[] getBuffer()- Specified by:
getBufferin interfaceFSTEncoder
-
registerClass
- Specified by:
registerClassin interfaceFSTEncoder
-
writeClass
- Specified by:
writeClassin interfaceFSTEncoder
-
writeClass
- Specified by:
writeClassin interfaceFSTEncoder
-
writeTag
public boolean writeTag(byte tag, Object infoOrObject, long somValue, Object toWrite, FSTObjectOutput oout) throws IOException- Specified by:
writeTagin interfaceFSTEncoder- Throws:
IOException
-
classToString
-
writeAttributeName
- Specified by:
writeAttributeNamein interfaceFSTEncoder
-
externalEnd
- Specified by:
externalEndin interfaceFSTEncoder
-
isWritingAttributes
public boolean isWritingAttributes()- Specified by:
isWritingAttributesin interfaceFSTEncoder
-
isPrimitiveArray
- Specified by:
isPrimitiveArrayin interfaceFSTEncoder
-
isTagMultiDimSubArrays
public boolean isTagMultiDimSubArrays()- Specified by:
isTagMultiDimSubArraysin interfaceFSTEncoder
-
writeVersionTag
- Specified by:
writeVersionTagin interfaceFSTEncoder- Throws:
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
-