public class FSTConfiguration extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
FSTConfiguration.ClassSecurityVerifier
Security: disallow packages/classes upon deserialization
|
protected static class |
FSTConfiguration.FBinaryStreamCoderFactory |
protected static class |
FSTConfiguration.FSTDefaultStreamCoderFactory |
static class |
FSTConfiguration.JacksonAccessWorkaround |
protected static class |
FSTConfiguration.JSonStreamCoderFactory |
static interface |
FSTConfiguration.LastResortClassRessolver
if all attempts fail to find a class this guy is asked.
|
protected static class |
FSTConfiguration.MinBinStreamCoderFactory |
static interface |
FSTConfiguration.StreamCoderFactory |
| Modifier and Type | Field and Description |
|---|---|
static boolean |
isAndroid |
| Modifier | Constructor and Description |
|---|---|
protected |
FSTConfiguration(ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> sharedFieldInfos) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
asByteArray(Object object)
convenience.
|
String |
asJsonString(Object o)
utility/debug method.
|
Object |
asObject(byte[] b)
convenience
|
byte[] |
asSharedByteArray(Object object,
int[] length)
Warning: avoids allocation + copying.
|
int |
calcObjectSizeBytesNotAUtility(Object obj)
for optimization purposes, do not use to benchmark processing time or in a regular program as
this methods creates a temporary binaryoutputstream and serializes the object in order to measure the
size.
|
void |
clearCaches()
clear cached softref's and ThreadLocal.
|
static void |
clearGlobalCaches()
clear global deduplication caches.
|
FSTConfiguration |
cpMap(String shortName,
Class clz)
shorthand for registerCrossPlatformClassMapping(_,_)
|
static FSTConfiguration |
createAndroidDefaultConfiguration()
Configuration for use on Android.
|
protected static FSTConfiguration |
createAndroidDefaultConfiguration(ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> shared) |
static FSTConfiguration |
createConfiguration(org.nustaq.serialization.FSTConfiguration.ConfType ct,
boolean shareRefs) |
protected static FSTConfiguration |
createConfiguration(org.nustaq.serialization.FSTConfiguration.ConfType ct,
boolean shareRefs,
ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> shared) |
static FSTConfiguration |
createDefaultConfiguration()
the standard FSTConfiguration.
|
protected static FSTConfiguration |
createDefaultConfiguration(ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> shared) |
static FSTConfiguration |
createJsonConfiguration(boolean prettyPrint,
boolean shareReferences)
create a json conf with given attributes.
|
protected static FSTConfiguration |
createJsonConfiguration(boolean prettyPrint,
boolean shareReferences,
ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> shared) |
static FSTConfiguration |
createJsonNoRefConfiguration() |
static FSTConfiguration |
createMinBinConfiguration()
Warning: MinBin contains full metainformation (fieldnames,..), so its way slower than the other configs.
|
protected static FSTConfiguration |
createMinBinConfiguration(ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> shared) |
FSTDecoder |
createStreamDecoder() |
FSTEncoder |
createStreamEncoder() |
static FSTConfiguration |
createStructConfiguration()
special configuration used internally for struct emulation
|
static FSTConfiguration |
createUnsafeBinaryConfiguration()
Returns a configuration using Unsafe to read write data.
|
protected static FSTConfiguration |
createUnsafeBinaryConfiguration(ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> shared) |
Object |
decodeFromStream(InputStream in) |
<T> T |
deepCopy(T metadata) |
FSTConfiguration |
deriveConfiguration() |
void |
encodeToStream(OutputStream out,
Object toSerialize)
helper to write series of objects to streams/files > Integer.MAX_VALUE.
|
Object |
getCachedObject(Class cl) |
String |
getClassForCPName(String name) |
FSTClazzInfo |
getClassInfo(Class type) |
ClassLoader |
getClassLoader() |
FSTClazzNameRegistry |
getClassRegistry() |
FSTClazzInfo |
getClazzInfo(Class rowClass) |
FSTClazzInfoRegistry |
getCLInfoRegistry() |
<T> T |
getCoderSpecific() |
String |
getCPNameForClass(Class cl)
get cross platform symbolic class identifier
|
byte[] |
getCrossPlatformBinaryCache(String symbolicName) |
static FSTConfiguration |
getDefaultConfiguration() |
protected FSTObjectInput |
getIn() |
FSTClassInstantiator |
getInstantiator(Class clazz) |
FSTConfiguration.LastResortClassRessolver |
getLastResortResolver() |
String |
getName()
debug helper
|
FSTObjectInput |
getObjectInput() |
FSTObjectInput |
getObjectInput(byte[] arr)
take the given array as input.
|
FSTObjectInput |
getObjectInput(byte[] arr,
int len)
take the given array as input.
|
FSTObjectInput |
getObjectInput(InputStream in)
utility for thread safety and reuse.
|
FSTObjectInput |
getObjectInputCopyFrom(byte[] arr,
int off,
int len)
take the given array and copy it to input.
|
FSTObjectOutput |
getObjectOutput() |
FSTObjectOutput |
getObjectOutput(byte[] outByte) |
FSTObjectOutput |
getObjectOutput(OutputStream out)
utility for thread safety and reuse.
|
protected FSTObjectOutput |
getOut() |
FSTConfiguration.StreamCoderFactory |
getStreamCoderFactory() |
FSTConfiguration.ClassSecurityVerifier |
getVerifier() |
protected static FSTConfiguration |
initDefaultFstConfigurationInternal(FSTConfiguration conf) |
boolean |
isCrossPlatform() |
boolean |
isForceClzInit() |
boolean |
isForceSerializable() |
boolean |
isPreferSpeed()
ignored currently
|
boolean |
isShareReferences() |
boolean |
isStructMode()
special for structs
|
static void |
prettyPrintJson(Object o)
debug only, very slow (creates config with each call).
|
void |
registerClass(Class... c)
Preregister a class (use at init time).
|
void |
registerCrossPlatformClassBinaryCache(String fulLQName,
byte[] binary) |
FSTConfiguration |
registerCrossPlatformClassMapping(String[][] keysAndVals)
init right after creation of configuration, not during operation as it is not threadsafe regarding mutation
currently only for minbin serialization
|
FSTConfiguration |
registerCrossPlatformClassMapping(String shortName,
String fqName) |
FSTConfiguration |
registerCrossPlatformClassMappingUseSimpleName(Class... classes)
init right after creation of configuration, not during operation as it is not threadsafe regarding mutation
|
FSTConfiguration |
registerCrossPlatformClassMappingUseSimpleName(List<Class> classes) |
void |
registerSerializer(Class clazz,
FSTObjectSerializer ser,
boolean alsoForAllSubclasses)
register a custom serializer for a given class or the class and all of its subclasses.
|
void |
returnObject(Object cached)
reuse heavy weight objects.
|
void |
setClassLoader(ClassLoader classLoader) |
void |
setCoderSpecific(Object coderSpecific) |
void |
setCrossPlatform(boolean crossPlatform) |
FSTConfiguration |
setForceClzInit(boolean forceClzInit)
always execute default fields init, even if no transients (so would get overwritten anyway)
required for lossy codecs (kson)
|
FSTConfiguration |
setForceSerializable(boolean forceSerializable)
treat unserializable classes same as if they would be serializable.
|
void |
setInstantiator(FSTClassInstantiator instantiator) |
void |
setLastResortResolver(FSTConfiguration.LastResortClassRessolver lastResortResolver) |
void |
setName(String name)
debug helper
|
void |
setPreferSpeed(boolean preferSpeed)
this options lets FST favour speed of encoding over size of the encoded object.
|
void |
setSerializerRegistryDelegate(FSTSerializerRegistryDelegate del)
patch default serializer lookup.
|
void |
setShareReferences(boolean shareReferences)
if false, identical objects will get serialized twice.
|
void |
setStreamCoderFactory(FSTConfiguration.StreamCoderFactory streamCoderFactory)
allows to use subclassed stream codecs.
|
void |
setStructMode(boolean ignoreSerialInterfaces)
ignores all serialization related interfaces (Serializable, Externalizable) and serializes all classes using the
default scheme.
|
FSTConfiguration |
setVerifier(FSTConfiguration.ClassSecurityVerifier verifier) |
String |
toString() |
protected FSTConfiguration(ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> sharedFieldInfos)
public FSTConfiguration.ClassSecurityVerifier getVerifier()
public FSTConfiguration setVerifier(FSTConfiguration.ClassSecurityVerifier verifier)
public String getName()
public void setName(String name)
name - public static FSTConfiguration getDefaultConfiguration()
public static FSTConfiguration createMinBinConfiguration()
protected static FSTConfiguration createMinBinConfiguration(ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> shared)
public static FSTConfiguration createJsonNoRefConfiguration()
public static FSTConfiguration createJsonConfiguration(boolean prettyPrint, boolean shareReferences)
prettyPrint - shareReferences - protected static FSTConfiguration createJsonConfiguration(boolean prettyPrint, boolean shareReferences, ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> shared)
public static void prettyPrintJson(Object o)
o - public static FSTConfiguration createAndroidDefaultConfiguration()
protected static FSTConfiguration createAndroidDefaultConfiguration(ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> shared)
public static FSTConfiguration createConfiguration(org.nustaq.serialization.FSTConfiguration.ConfType ct, boolean shareRefs)
protected static FSTConfiguration createConfiguration(org.nustaq.serialization.FSTConfiguration.ConfType ct, boolean shareRefs, ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> shared)
public static FSTConfiguration createDefaultConfiguration()
protected static FSTConfiguration createDefaultConfiguration(ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> shared)
protected static FSTConfiguration initDefaultFstConfigurationInternal(FSTConfiguration conf)
public static FSTConfiguration createUnsafeBinaryConfiguration()
protected static FSTConfiguration createUnsafeBinaryConfiguration(ConcurrentHashMap<org.nustaq.serialization.FSTConfiguration.FieldKey,FSTClazzInfo.FSTFieldInfo> shared)
public void registerSerializer(Class clazz, FSTObjectSerializer ser, boolean alsoForAllSubclasses)
clazz - ser - alsoForAllSubclasses - public boolean isForceClzInit()
public FSTConfiguration.LastResortClassRessolver getLastResortResolver()
public void setLastResortResolver(FSTConfiguration.LastResortClassRessolver lastResortResolver)
public FSTConfiguration setForceClzInit(boolean forceClzInit)
forceClzInit - public FSTClassInstantiator getInstantiator(Class clazz)
public void setInstantiator(FSTClassInstantiator instantiator)
public <T> T getCoderSpecific()
public void setCoderSpecific(Object coderSpecific)
public void setClassLoader(ClassLoader classLoader)
public static FSTConfiguration createStructConfiguration()
public FSTConfiguration.StreamCoderFactory getStreamCoderFactory()
public void setStreamCoderFactory(FSTConfiguration.StreamCoderFactory streamCoderFactory)
streamCoderFactory - public void returnObject(Object cached)
cached - public boolean isPreferSpeed()
public void setPreferSpeed(boolean preferSpeed)
preferSpeed - public int calcObjectSizeBytesNotAUtility(Object obj) throws IOException
IOExceptionpublic void setSerializerRegistryDelegate(FSTSerializerRegistryDelegate del)
del - public boolean isForceSerializable()
public FSTConfiguration setForceSerializable(boolean forceSerializable)
forceSerializable - //public static void clearGlobalCaches()
public void clearCaches()
public boolean isShareReferences()
public void setShareReferences(boolean shareReferences)
shareReferences - public void registerClass(Class... c)
public FSTClazzNameRegistry getClassRegistry()
public FSTClazzInfoRegistry getCLInfoRegistry()
public ClassLoader getClassLoader()
public FSTClazzInfo getClassInfo(Class type)
public FSTObjectInput getObjectInput(InputStream in)
in - public FSTObjectInput getObjectInput()
public FSTObjectInput getObjectInput(byte[] arr)
arr - public FSTObjectInput getObjectInput(byte[] arr, int len)
arr - len - public FSTObjectInput getObjectInputCopyFrom(byte[] arr, int off, int len)
arr - len - protected FSTObjectInput getIn()
protected FSTObjectOutput getOut()
public FSTObjectOutput getObjectOutput(OutputStream out)
out - - can be null (temp bytearrays stream is created then)public FSTObjectOutput getObjectOutput()
public FSTObjectOutput getObjectOutput(byte[] outByte)
public void setStructMode(boolean ignoreSerialInterfaces)
ignoreSerialInterfaces - public boolean isStructMode()
public FSTClazzInfo getClazzInfo(Class rowClass)
public void setCrossPlatform(boolean crossPlatform)
public boolean isCrossPlatform()
public <T> T deepCopy(T metadata)
public FSTEncoder createStreamEncoder()
public FSTDecoder createStreamDecoder()
public void registerCrossPlatformClassBinaryCache(String fulLQName, byte[] binary)
public byte[] getCrossPlatformBinaryCache(String symbolicName)
public FSTConfiguration registerCrossPlatformClassMapping(String[][] keysAndVals)
keysAndVals - { { "symbolicName", "fullQualifiedClazzName" }, .. }public FSTConfiguration registerCrossPlatformClassMapping(String shortName, String fqName)
public FSTConfiguration cpMap(String shortName, Class clz)
shortName - - class name in json type fieldclz - - classpublic FSTConfiguration registerCrossPlatformClassMappingUseSimpleName(Class... classes)
public FSTConfiguration registerCrossPlatformClassMappingUseSimpleName(List<Class> classes)
public String getCPNameForClass(Class cl)
cl - public Object asObject(byte[] b)
public byte[] asByteArray(Object object)
public byte[] asSharedByteArray(Object object, int[] length)
public String asJsonString(Object o)
o - public void encodeToStream(OutputStream out, Object toSerialize) throws IOException
out - toSerialize - IOExceptiondecodeFromStreampublic Object decodeFromStream(InputStream in) throws Exception
in - ExceptionencodeToStreampublic FSTConfiguration deriveConfiguration()
Copyright © 2016. All rights reserved.