Package org.nustaq.serialization
Class FSTObjectInput
java.lang.Object
org.nustaq.serialization.FSTObjectInput
- All Implemented Interfaces:
DataInput,ObjectInput,AutoCloseable
- Direct Known Subclasses:
FSTObjectInputNoShared
public class FSTObjectInput extends Object implements ObjectInput
replacement of ObjectInputStream
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classFSTObjectInput.CallbackEntrystatic interfaceFSTObjectInput.ConditionalCallbackprotected static classFSTObjectInput.MyObjectStream -
Field Summary
Fields Modifier and Type Field Description protected ArrayList<FSTObjectInput.CallbackEntry>callbacksprotected FSTClazzInfoRegistryclInfoRegistryprotected booleanclosedprotected FSTDecodercodecprotected FSTObjectInput.ConditionalCallbackconditionalCallbackprotected FSTConfigurationconfprotected intcurDepthprotected Stack<String>debugStackstatic ByteArrayInputStreamemptyStreamprotected FSTObjectInput.MyObjectStreamfakeWrapperprotected booleanignoreAnnotationsprotected FSTClazzInfo.FSTFieldInfoinfoCacheprotected booleanisCrossPlatformprotected FSTObjectRegistryobjectsprotected intreadExternalReadAHeadstatic booleanREGISTER_ENUMS_READprotected VersionConflictListenerversionConflictListener -
Constructor Summary
Constructors Constructor Description FSTObjectInput()FSTObjectInput(InputStream in)Creates a FSTObjectInput that uses the specified underlying InputStream.FSTObjectInput(InputStream in, FSTConfiguration conf)Creates a FSTObjectInput that uses the specified underlying InputStream.FSTObjectInput(FSTConfiguration conf) -
Method Summary
-
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)
-