Package org.nustaq.serialization.coders
Class FSTStreamDecoder
java.lang.Object
org.nustaq.serialization.coders.FSTStreamDecoder
- All Implemented Interfaces:
FSTDecoder
public class FSTStreamDecoder extends java.lang.Object implements FSTDecoder
Default Coder used for serialization. Decodes a binary stream written with FSTStreamEncoder
-
Field Summary
Fields Modifier and Type Field Description FSTClazzNameRegistryclnames -
Constructor Summary
Constructors Constructor Description FSTStreamDecoder(FSTConfiguration conf) -
Method Summary
Modifier and Type Method Description void_readFIntArr(int len, int[] arr)intavailable()java.lang.ClassclassForName(java.lang.String name)voidclose()java.lang.ObjectcoerceElement(java.lang.Class arrType, java.lang.Object value)voidconsumeEndMarker()voidendFieldReading(java.lang.Object newObj)only called when reading named fieldsintensureReadAhead(int bytes)byte[]getBuffer()java.lang.ObjectgetDirectObject()intgetInputPos()java.io.InputStreamgetInputStream()intgetObjectHeaderLen()booleaninArray()return wether current stream is reading an object or sequence currently makes sense for MinBin and JSon only, only Json serializer actually has implemented itbooleanisEndMarker(java.lang.String s)booleanisMapBased()voidmoveTo(int position)voidpushBack(int bytes)voidreadArrayEnd(FSTClazzInfo clzSerInfo)java.lang.ClassreadArrayHeader()FSTClazzInforeadClass()voidreadExternalEnd()bytereadFByte()charreadFChar()doublereadFDouble()floatreadFFloat()Reads a 4 byte float.intreadFInt()voidreadFIntArr(int len, int[] arr)longreadFLong()voidreadFLongArr(int len, long[] arr)java.lang.ObjectreadFPrimitiveArray(java.lang.Object array, java.lang.Class componentType, int len)assumes class header+len already readshortreadFShort()intreadIntByte()voidreadObjectEnd()bytereadObjectHeaderTag()voidreadPlainBytes(byte[] b, int off, int len)intreadPlainInt()java.lang.StringreadStringAsc()len < 127 !!!!!java.lang.StringreadStringUTF()intreadVersionTag()voidregisterClass(java.lang.Class possible)voidreset()voidresetToCopyOf(byte[] bytes, int off, int len)voidresetWith(byte[] bytes, int len)voidsetConf(FSTConfiguration conf)voidsetInputStream(java.io.InputStream in)voidskip(int n)voidstartFieldReading(java.lang.Object newObj)quirks for json unknown decoding.
-
Field Details
-
Constructor Details
-
Method Details
-
setConf
- Specified by:
setConfin interfaceFSTDecoder
-
ensureReadAhead
public int ensureReadAhead(int bytes)- Specified by:
ensureReadAheadin interfaceFSTDecoder
-
readStringUTF
public java.lang.String readStringUTF() throws java.io.IOException- Specified by:
readStringUTFin interfaceFSTDecoder- Throws:
java.io.IOException
-
readObjectHeaderTag
public byte readObjectHeaderTag() throws java.io.IOException- Specified by:
readObjectHeaderTagin interfaceFSTDecoder- Throws:
java.io.IOException
-
readStringAsc
public java.lang.String readStringAsc() throws java.io.IOExceptionlen < 127 !!!!!- Specified by:
readStringAscin interfaceFSTDecoder- Returns:
- Throws:
java.io.IOException
-
readFPrimitiveArray
public java.lang.Object readFPrimitiveArray(java.lang.Object array, java.lang.Class componentType, int len)assumes class header+len already read- Specified by:
readFPrimitiveArrayin interfaceFSTDecoder- Parameters:
componentType-len-- Returns:
-
_readFIntArr
public void _readFIntArr(int len, int[] arr) throws java.io.IOException- Throws:
java.io.IOException
-
readFIntArr
public void readFIntArr(int len, int[] arr) throws java.io.IOException- Specified by:
readFIntArrin interfaceFSTDecoder- Throws:
java.io.IOException
-
readFLongArr
public void readFLongArr(int len, long[] arr) throws java.io.IOException- Throws:
java.io.IOException
-
readFInt
public int readFInt() throws java.io.IOException- Specified by:
readFIntin interfaceFSTDecoder- Throws:
java.io.IOException
-
readFDouble
public double readFDouble() throws java.io.IOException- Specified by:
readFDoublein interfaceFSTDecoder- Throws:
java.io.IOException
-
readFFloat
public float readFFloat() throws java.io.IOExceptionReads a 4 byte float.- Specified by:
readFFloatin interfaceFSTDecoder- Throws:
java.io.IOException
-
readFByte
public final byte readFByte() throws java.io.IOException- Specified by:
readFBytein interfaceFSTDecoder- Throws:
java.io.IOException
-
readIntByte
public final int readIntByte() throws java.io.IOException- Specified by:
readIntBytein interfaceFSTDecoder- Throws:
java.io.IOException
-
readFLong
public long readFLong() throws java.io.IOException- Specified by:
readFLongin interfaceFSTDecoder- Throws:
java.io.IOException
-
readFChar
public char readFChar() throws java.io.IOException- Specified by:
readFCharin interfaceFSTDecoder- Throws:
java.io.IOException
-
readFShort
public short readFShort() throws java.io.IOException- Specified by:
readFShortin interfaceFSTDecoder- Throws:
java.io.IOException
-
readPlainInt
public int readPlainInt() throws java.io.IOException- Specified by:
readPlainIntin interfaceFSTDecoder- Throws:
java.io.IOException
-
getBuffer
public byte[] getBuffer()- Specified by:
getBufferin interfaceFSTDecoder
-
getInputPos
public int getInputPos()- Specified by:
getInputPosin interfaceFSTDecoder
-
moveTo
public void moveTo(int position)- Specified by:
moveToin interfaceFSTDecoder
-
reset
public void reset()- Specified by:
resetin interfaceFSTDecoder
-
setInputStream
public void setInputStream(java.io.InputStream in)- Specified by:
setInputStreamin interfaceFSTDecoder
-
getInputStream
public java.io.InputStream getInputStream() -
resetToCopyOf
public void resetToCopyOf(byte[] bytes, int off, int len)- Specified by:
resetToCopyOfin interfaceFSTDecoder
-
resetWith
public void resetWith(byte[] bytes, int len)- Specified by:
resetWithin interfaceFSTDecoder
-
readClass
- Specified by:
readClassin interfaceFSTDecoder- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
classForName
public java.lang.Class classForName(java.lang.String name) throws java.lang.ClassNotFoundException- Specified by:
classForNamein interfaceFSTDecoder- Throws:
java.lang.ClassNotFoundException
-
registerClass
public void registerClass(java.lang.Class possible)- Specified by:
registerClassin interfaceFSTDecoder
-
close
public void close()- Specified by:
closein interfaceFSTDecoder
-
skip
public void skip(int n)- Specified by:
skipin interfaceFSTDecoder
-
readPlainBytes
public void readPlainBytes(byte[] b, int off, int len)- Specified by:
readPlainBytesin interfaceFSTDecoder
-
isMapBased
public boolean isMapBased()- Specified by:
isMapBasedin interfaceFSTDecoder
-
getDirectObject
public java.lang.Object getDirectObject()- Specified by:
getDirectObjectin interfaceFSTDecoder
-
getObjectHeaderLen
public int getObjectHeaderLen()- Specified by:
getObjectHeaderLenin interfaceFSTDecoder
-
consumeEndMarker
public void consumeEndMarker()- Specified by:
consumeEndMarkerin interfaceFSTDecoder
-
readArrayHeader
public java.lang.Class readArrayHeader() throws java.lang.Exception- Specified by:
readArrayHeaderin interfaceFSTDecoder- Throws:
java.lang.Exception
-
readExternalEnd
public void readExternalEnd()- Specified by:
readExternalEndin interfaceFSTDecoder
-
isEndMarker
public boolean isEndMarker(java.lang.String s)- Specified by:
isEndMarkerin interfaceFSTDecoder
-
readVersionTag
public int readVersionTag() throws java.io.IOException- Specified by:
readVersionTagin interfaceFSTDecoder- Throws:
java.io.IOException
-
pushBack
public void pushBack(int bytes)- Specified by:
pushBackin interfaceFSTDecoder
-
readArrayEnd
- Specified by:
readArrayEndin interfaceFSTDecoder
-
readObjectEnd
public void readObjectEnd()- Specified by:
readObjectEndin interfaceFSTDecoder
-
coerceElement
public java.lang.Object coerceElement(java.lang.Class arrType, java.lang.Object value)- Specified by:
coerceElementin interfaceFSTDecoder
-
available
public int available()- Specified by:
availablein interfaceFSTDecoder- Returns:
- a value > 0 if more bytes are available
-
inArray
public boolean inArray()Description copied from interface:FSTDecoderreturn wether current stream is reading an object or sequence currently makes sense for MinBin and JSon only, only Json serializer actually has implemented it- Specified by:
inArrayin interfaceFSTDecoder- Returns:
-
startFieldReading
public void startFieldReading(java.lang.Object newObj)Description copied from interface:FSTDecoderquirks for json unknown decoding. Need a hook to set original classname only called when reading named fields- Specified by:
startFieldReadingin interfaceFSTDecoder
-
endFieldReading
public void endFieldReading(java.lang.Object newObj)Description copied from interface:FSTDecoderonly called when reading named fields- Specified by:
endFieldReadingin interfaceFSTDecoder
-