Package org.nustaq.serialization.coders
Class FSTStreamEncoder
java.lang.Object
org.nustaq.serialization.coders.FSTStreamEncoder
- All Implemented Interfaces:
FSTEncoder
Default Coder used for serialization. Serializes into a binary stream
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid_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[]getConf()intbooleanbooleanisPrimitiveArray(Object array, Class<?> componentType) booleanbooleanvoidregisterClass(Class possible) voidreset(byte[] out) voidsetConf(FSTConfiguration conf) voidsetOutstream(OutputStream outstream) if output stream is null, just encode into a byte arrayvoidskip(int i) voidbooleanwriteAttributeName(FSTClazzInfo.FSTFieldInfo subInfo, Object value) final voidwriteClass(Class cl) final voidwriteClass(FSTClazzInfo clInf) final 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(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(String str) booleanwriteTag(byte tag, Object info, long somValue, Object toWrite, FSTObjectOutput oout) voidwriteVersionTag(int version)
-
Constructor Details
-
FSTStreamEncoder
-
-
Method Details
-
setConf
- Specified by:
setConfin interfaceFSTEncoder
-
writeFFloatArr
- Throws:
IOException
-
writeFDoubleArr
- Throws:
IOException
-
writeFShortArr
- Throws:
IOException
-
writeFCharArr
- Throws:
IOException
-
writeFIntArr
- Throws:
IOException
-
_writeFIntArr
- Throws:
IOException
-
writePrimitiveArray
write prim array no len no tag- Specified by:
writePrimitiveArrayin interfaceFSTEncoder- Parameters:
array-- Throws:
IOException
-
writeRawBytes
does not write length, just plain bytes- Specified by:
writeRawBytesin interfaceFSTEncoder- Parameters:
array-length-- Throws:
IOException
-
writeStringUTF
- Specified by:
writeStringUTFin interfaceFSTEncoder- Throws:
IOException
-
writeFShort
- Specified by:
writeFShortin interfaceFSTEncoder- Throws:
IOException
-
writeAttributeName
- Specified by:
writeAttributeNamein interfaceFSTEncoder
-
writeTag
public boolean writeTag(byte tag, Object info, long somValue, Object toWrite, FSTObjectOutput oout) throws IOException - Specified by:
writeTagin 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
Writes a 4 byte float.- Specified by:
writeFFloatin interfaceFSTEncoder- Throws:
IOException
-
writeFDouble
- Specified by:
writeFDoublein interfaceFSTEncoder- Throws:
IOException
-
getWritten
public int getWritten()- Specified by:
getWrittenin interfaceFSTEncoder
-
close
close and flush to underlying stream if present. The stream is also closed- Specified by:
closein interfaceFSTEncoder- Throws:
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
if output stream is null, just encode into a byte array- Specified by:
setOutstreamin interfaceFSTEncoder- Parameters:
outstream-
-
getOutstream
-
flush
writes current buffer to underlying output and resets buffer.- Specified by:
flushin interfaceFSTEncoder- 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
-
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
-