Package org.nustaq.serialization.coders
Class FSTStreamEncoder
java.lang.Object
org.nustaq.serialization.coders.FSTStreamEncoder
- All Implemented Interfaces:
FSTEncoder
public class FSTStreamEncoder extends java.lang.Object implements FSTEncoder
Default Coder used for serialization. Serializes into a binary stream
-
Constructor Summary
Constructors Constructor Description FSTStreamEncoder(FSTConfiguration conf) -
Method Summary
Modifier and Type Method Description void_writeFIntArr(int[] v, int off, int len)voidclose()close and flush to underlying stream if present.voidensureFree(int bytes)voidexternalEnd(FSTClazzInfo clz)voidflush()writes current buffer to underlying output and resets buffer.byte[]getBuffer()FSTConfigurationgetConf()java.io.OutputStreamgetOutstream()intgetWritten()booleanisByteArrayBased()booleanisPrimitiveArray(java.lang.Object array, java.lang.Class<?> componentType)booleanisTagMultiDimSubArrays()booleanisWritingAttributes()voidregisterClass(java.lang.Class possible)voidreset(byte[] out)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 value)voidwriteClass(java.lang.Class cl)voidwriteClass(FSTClazzInfo clInf)voidwriteFByte(int v)voidwriteFChar(char c)voidwriteFCharArr(char[] arr, int off, int len)voidwriteFDouble(double value)voidwriteFDoubleArr(double[] arr, int off, int len)voidwriteFFloat(float value)Writes a 4 byte float.voidwriteFFloatArr(float[] arr, int off, int len)voidwriteFieldsEnd(FSTClazzInfo serializationInfo)voidwriteFInt(int anInt)voidwriteFIntArr(int[] arr, int off, int len)voidwriteFLong(long anInt)voidwriteFShort(short c)voidwriteFShortArr(short[] arr, int off, int len)voidwriteInt32At(int position, int v)used to write uncompressed int (guaranteed length = 4) at a (eventually recent) positionvoidwritePrimitiveArray(java.lang.Object array, int off, int len)write prim array no len no tagvoidwriteRawBytes(byte[] array, int start, int length)does not write length, just plain bytesvoidwriteStringUTF(java.lang.String str)booleanwriteTag(byte tag, java.lang.Object info, long somValue, java.lang.Object toWrite, FSTObjectOutput oout)voidwriteVersionTag(int version)
-
Constructor Details
-
Method Details
-
setConf
- Specified by:
setConfin interfaceFSTEncoder
-
writeFFloatArr
public void writeFFloatArr(float[] arr, int off, int len) throws java.io.IOException- Throws:
java.io.IOException
-
writeFDoubleArr
public void writeFDoubleArr(double[] arr, int off, int len) throws java.io.IOException- Throws:
java.io.IOException
-
writeFShortArr
public void writeFShortArr(short[] arr, int off, int len) throws java.io.IOException- Throws:
java.io.IOException
-
writeFCharArr
public void writeFCharArr(char[] arr, int off, int len) throws java.io.IOException- Throws:
java.io.IOException
-
writeFIntArr
public void writeFIntArr(int[] arr, int off, int len) throws java.io.IOException- Throws:
java.io.IOException
-
_writeFIntArr
public void _writeFIntArr(int[] v, int off, int len) throws java.io.IOException- Throws:
java.io.IOException
-
writePrimitiveArray
public void writePrimitiveArray(java.lang.Object array, int off, int len) throws java.io.IOExceptionwrite prim array no len no tag- Specified by:
writePrimitiveArrayin interfaceFSTEncoder- Parameters:
array-- Throws:
java.io.IOException
-
writeRawBytes
public void writeRawBytes(byte[] array, int start, int length) throws java.io.IOExceptiondoes not write length, just plain bytes- Specified by:
writeRawBytesin interfaceFSTEncoder- Parameters:
array-length-- 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
-
writeAttributeName
- Specified by:
writeAttributeNamein interfaceFSTEncoder
-
writeTag
public boolean writeTag(byte tag, java.lang.Object info, long somValue, java.lang.Object toWrite, FSTObjectOutput oout) throws java.io.IOException- Specified by:
writeTagin 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 final 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.IOExceptionWrites a 4 byte float.- 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
-
close
public void close() throws java.io.IOExceptionclose 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[] out)- Specified by:
resetin interfaceFSTEncoder
-
skip
public void skip(int i)- Specified by:
skipin interfaceFSTEncoder
-
writeInt32At
public void writeInt32At(int position, int v)used to write uncompressed int (guaranteed length = 4) at a (eventually recent) position- Specified by:
writeInt32Atin interfaceFSTEncoder- Parameters:
position-v-
-
setOutstream
public void setOutstream(java.io.OutputStream outstream)if output stream is null, just encode into a byte array- Specified by:
setOutstreamin interfaceFSTEncoder- Parameters:
outstream-
-
getOutstream
public java.io.OutputStream getOutstream() -
flush
public void flush() throws java.io.IOExceptionwrites current buffer to underlying output and resets buffer.- Specified by:
flushin interfaceFSTEncoder- 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 final void writeClass(java.lang.Class cl)- Specified by:
writeClassin interfaceFSTEncoder
-
writeClass
- Specified by:
writeClassin 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
-