Package org.nustaq.serialization
Class FSTObjectInput
java.lang.Object
org.nustaq.serialization.FSTObjectInput
- All Implemented Interfaces:
DataInput,ObjectInput,AutoCloseable
- Direct Known Subclasses:
FSTObjectInputNoShared
replacement of ObjectInputStream
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic interfaceprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ArrayList<FSTObjectInput.CallbackEntry>protected FSTClazzInfoRegistryprotected booleanprotected FSTDecoderprotected FSTObjectInput.ConditionalCallbackprotected FSTConfigurationprotected intstatic ByteArrayInputStreamprotected FSTObjectInput.MyObjectStreamprotected booleanprotected FSTClazzInfo.FSTFieldInfoprotected booleanprotected FSTObjectRegistryprotected intstatic booleanprotected VersionConflictListener -
Constructor Summary
ConstructorsConstructorDescriptionCreates a FSTObjectInput that uses the specified underlying InputStream.FSTObjectInput(InputStream in, FSTConfiguration conf) Creates a FSTObjectInput that uses the specified underlying InputStream. -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()voiddefaultReadObject(FSTClazzInfo.FSTFieldInfo referencee, FSTClazzInfo serializationInfo, Object newObj) getClassForName(String name) protected FSTClazzInfogetClazzInfo(Class c, FSTClazzInfo.FSTFieldInfo referencee) getCodec()getConf()protected ObjectInputStreamgetObjectInputStream(Class cl, FSTClazzInfo clInfo, FSTClazzInfo.FSTFieldInfo referencee, Object toRead) intprotected ObjecthandleReadRessolve(FSTClazzInfo serializationInfo, Object newObj) protected voidprotected ObjectinstantiateAndReadNoSer(Class c, FSTClazzInfo clzSerInfo, FSTClazzInfo.FSTFieldInfo referencee, int readPos) protected ObjectinstantiateAndReadWithSer(Class c, FSTObjectSerializer ser, FSTClazzInfo clzSerInfo, FSTClazzInfo.FSTFieldInfo referencee, int readPos) protected ObjectinstantiateArray(FSTClazzInfo.FSTFieldInfo referencee, int readPos) protected Objectprotected ObjectinstantiateEnum(FSTClazzInfo.FSTFieldInfo referencee, int readPos) protected ObjectinstantiateHandle(FSTClazzInfo.FSTFieldInfo referencee) protected ObjectinstantiateSpecialTag(FSTClazzInfo.FSTFieldInfo referencee, int readPos, byte code) booleanisClosed()protected voidoldVersionRead(Object newObj) protected voidprotected voidpushBack(int i) intread()intread(byte[] b) intread(byte[] b, int off, int len) protected ObjectreadArray(FSTClazzInfo.FSTFieldInfo referencee, int pos) protected ObjectreadArrayNoHeader(FSTClazzInfo.FSTFieldInfo referencee, int pos, Class arrCl) booleanbytereadByte()charreadChar()protected voidreadCompatibleObjectFields(FSTClazzInfo.FSTFieldInfo referencee, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo[] fieldInfo, Map res) doubleprotected voidreadFieldsMapBased(FSTClazzInfo.FSTFieldInfo referencee, FSTClazzInfo serializationInfo, Object newObj) final intreadFInt()floatvoidreadFully(byte[] b) voidreadFully(byte[] b, int off, int len) intreadInt()readLine()longreadLong()readObject(Class... possibles) protected ObjectreadObjectCompatible(FSTClazzInfo.FSTFieldInfo referencee, FSTClazzInfo serializationInfo, Object newObj) protected voidreadObjectCompatibleRecursive(FSTClazzInfo.FSTFieldInfo referencee, Object toRead, FSTClazzInfo serializationInfo, Class cl) protected voidreadObjectFields(FSTClazzInfo.FSTFieldInfo referencee, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo[] fieldInfo, Object newObj, int startIndex, int version) readObjectInternal(Class... expected) readObjectWithHeader(FSTClazzInfo.FSTFieldInfo referencee) shortlen < 127 !!!!!intintreadUTF()voidregisterObject(Object o, int streamPosition, FSTClazzInfo info, FSTClazzInfo.FSTFieldInfo referencee) voidreset()protected voidvoidvoidresetForReuseCopyArray(byte[] bytes, int off, int len) voidresetForReuseUseArray(byte[] bytes) voidresetForReuseUseArray(byte[] bytes, int len) protected voidsetCodec(FSTDecoder codec) voidsetConditionalCallback(FSTObjectInput.ConditionalCallback conditionalCallback) voidsetReadExternalReadAHead(int readExternalReadAHead) since the stock readXX methods on InputStream are final, i can't ensure sufficient readAhead on the inputStream before calling readExternal.voidsetVersionConflictListener(VersionConflictListener versionConflictListener) see @Version annotationlongskip(long n) intskipBytes(int n) protected booleanskipConditional(Object newObj, int conditional, FSTClazzInfo.FSTFieldInfo subInfo)
-
Field Details
-
REGISTER_ENUMS_READ
public static boolean REGISTER_ENUMS_READ -
emptyStream
-
codec
-
objects
-
debugStack
-
curDepth
protected int curDepth -
callbacks
-
ignoreAnnotations
protected boolean ignoreAnnotations -
clInfoRegistry
-
conditionalCallback
-
readExternalReadAHead
protected int readExternalReadAHead -
versionConflictListener
-
conf
-
isCrossPlatform
protected boolean isCrossPlatform -
infoCache
-
closed
protected boolean closed -
fakeWrapper
-
-
Constructor Details
-
FSTObjectInput
- Throws:
IOException
-
FSTObjectInput
-
FSTObjectInput
Creates a FSTObjectInput that uses the specified underlying InputStream.- Parameters:
in- the specified input stream- Throws:
IOException
-
FSTObjectInput
Creates a FSTObjectInput that uses the specified underlying InputStream. Don't create a FSTConfiguration with each stream, just create one global static configuration and reuseit. FSTConfiguration is threadsafe.- Parameters:
in- the specified input stream
-
-
Method Details
-
getConf
-
readFully
- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
skipBytes
- Specified by:
skipBytesin interfaceDataInput- Throws:
IOException
-
readBoolean
- Specified by:
readBooleanin interfaceDataInput- Throws:
IOException
-
readByte
- Specified by:
readBytein interfaceDataInput- Throws:
IOException
-
readUnsignedByte
- Specified by:
readUnsignedBytein interfaceDataInput- Throws:
IOException
-
readShort
- Specified by:
readShortin interfaceDataInput- Throws:
IOException
-
readUnsignedShort
- Specified by:
readUnsignedShortin interfaceDataInput- Throws:
IOException
-
readChar
- Specified by:
readCharin interfaceDataInput- Throws:
IOException
-
readInt
- Specified by:
readIntin interfaceDataInput- Throws:
IOException
-
readLong
- Specified by:
readLongin interfaceDataInput- Throws:
IOException
-
readFloat
- Specified by:
readFloatin interfaceDataInput- Throws:
IOException
-
readDouble
- Specified by:
readDoublein interfaceDataInput- Throws:
IOException
-
readLine
- Specified by:
readLinein interfaceDataInput- Throws:
IOException
-
readUTF
- Specified by:
readUTFin interfaceDataInput- Throws:
IOException
-
getCodec
-
setCodec
-
isClosed
public boolean isClosed() -
getClassForName
- Throws:
ClassNotFoundException
-
initRegistries
-
getConditionalCallback
-
setConditionalCallback
-
getReadExternalReadAHead
public int getReadExternalReadAHead() -
setReadExternalReadAHead
public void setReadExternalReadAHead(int readExternalReadAHead) since the stock readXX methods on InputStream are final, i can't ensure sufficient readAhead on the inputStream before calling readExternal. Default value is 16000 bytes. If you make use of the externalizable interfac and write larger Objects a) cast the ObjectInput in readExternal to FSTObjectInput and call ensureReadAhead on this in your readExternal method b) set a sufficient maximum using this method before serializing.- Parameters:
readExternalReadAHead-
-
readObject
- Specified by:
readObjectin interfaceObjectInput- Throws:
ClassNotFoundExceptionIOException
-
read
- Specified by:
readin interfaceObjectInput- Throws:
IOException
-
read
- Specified by:
readin interfaceObjectInput- Throws:
IOException
-
read
- Specified by:
readin interfaceObjectInput- Throws:
IOException
-
skip
- Specified by:
skipin interfaceObjectInput- Throws:
IOException
-
available
- Specified by:
availablein interfaceObjectInput- Throws:
IOException
-
processValidation
- Throws:
InvalidObjectException
-
readObject
- Throws:
Exception
-
readObjectInternal
public Object readObjectInternal(Class... expected) throws ClassNotFoundException, IOException, IllegalAccessException, InstantiationException -
readObjectWithHeader
- Throws:
Exception
-
instantiateSpecialTag
protected Object instantiateSpecialTag(FSTClazzInfo.FSTFieldInfo referencee, int readPos, byte code) throws Exception - Throws:
Exception
-
getClazzInfo
-
instantiateHandle
- Throws:
IOException
-
instantiateArray
protected Object instantiateArray(FSTClazzInfo.FSTFieldInfo referencee, int readPos) throws Exception - Throws:
Exception
-
instantiateEnum
protected Object instantiateEnum(FSTClazzInfo.FSTFieldInfo referencee, int readPos) throws IOException, ClassNotFoundException - Throws:
IOExceptionClassNotFoundException
-
instantiateBigInt
- Throws:
IOException
-
instantiateAndReadWithSer
protected Object instantiateAndReadWithSer(Class c, FSTObjectSerializer ser, FSTClazzInfo clzSerInfo, FSTClazzInfo.FSTFieldInfo referencee, int readPos) throws Exception - Throws:
Exception
-
instantiateAndReadNoSer
protected Object instantiateAndReadNoSer(Class c, FSTClazzInfo clzSerInfo, FSTClazzInfo.FSTFieldInfo referencee, int readPos) throws Exception - Throws:
Exception
-
readObjectCompatible
protected Object readObjectCompatible(FSTClazzInfo.FSTFieldInfo referencee, FSTClazzInfo serializationInfo, Object newObj) throws Exception - Throws:
Exception
-
handleReadRessolve
protected Object handleReadRessolve(FSTClazzInfo serializationInfo, Object newObj) throws IllegalAccessException - Throws:
IllegalAccessException
-
readObjectCompatibleRecursive
protected void readObjectCompatibleRecursive(FSTClazzInfo.FSTFieldInfo referencee, Object toRead, FSTClazzInfo serializationInfo, Class cl) throws Exception - Throws:
Exception
-
defaultReadObject
public void defaultReadObject(FSTClazzInfo.FSTFieldInfo referencee, FSTClazzInfo serializationInfo, Object newObj) -
readObjectFields
protected void readObjectFields(FSTClazzInfo.FSTFieldInfo referencee, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo[] fieldInfo, Object newObj, int startIndex, int version) throws Exception - Throws:
Exception
-
getVersionConflictListener
-
setVersionConflictListener
see @Version annotation- Parameters:
versionConflictListener-
-
oldVersionRead
-
readFieldsMapBased
protected void readFieldsMapBased(FSTClazzInfo.FSTFieldInfo referencee, FSTClazzInfo serializationInfo, Object newObj) throws Exception - Throws:
Exception
-
skipConditional
protected boolean skipConditional(Object newObj, int conditional, FSTClazzInfo.FSTFieldInfo subInfo) -
readCompatibleObjectFields
protected void readCompatibleObjectFields(FSTClazzInfo.FSTFieldInfo referencee, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo[] fieldInfo, Map res) throws Exception - Throws:
Exception
-
readStringUTF
- Throws:
IOException
-
readStringAsc
len < 127 !!!!!- Returns:
- Throws:
IOException
-
readArray
- Throws:
Exception
-
readArrayNoHeader
protected Object readArrayNoHeader(FSTClazzInfo.FSTFieldInfo referencee, int pos, Class arrCl) throws Exception - Throws:
Exception
-
registerObject
public void registerObject(Object o, int streamPosition, FSTClazzInfo info, FSTClazzInfo.FSTFieldInfo referencee) -
readClass
- Throws:
IOExceptionClassNotFoundException
-
resetAndClearRefs
protected void resetAndClearRefs() -
reset
- Throws:
IOException
-
resetForReuse
- Throws:
IOException
-
resetForReuseCopyArray
- Throws:
IOException
-
resetForReuseUseArray
- Throws:
IOException
-
resetForReuseUseArray
- Throws:
IOException
-
readFInt
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceObjectInput- Throws:
IOException
-
getObjectInputStream
protected ObjectInputStream getObjectInputStream(Class cl, FSTClazzInfo clInfo, FSTClazzInfo.FSTFieldInfo referencee, Object toRead) throws IOException - Throws:
IOException
-
pushBack
protected void pushBack(int i)
-