public class FSTConfiguration extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
FSTConfiguration.StreamCoderFactory |
| Modifier and Type | Field and Description |
|---|---|
static boolean |
isAndroid |
| Modifier | Constructor and Description |
|---|---|
protected |
FSTConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
asByteArray(Object object)
convenience.
|
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 FSTConfiguration |
createAndroidDefaultConfiguration()
Configuration for use on Android.
|
static FSTConfiguration |
createDefaultConfiguration()
the standard FSTConfiguration
|
static FSTConfiguration |
createFastBinaryConfiguration()
Returns a configuration using Unsafe to read write data
|
static FSTConfiguration |
createMinBinConfiguration()
Warning: MinBin contains full metainformation (fieldnames,..), so its way slower than the other configs.
|
FSTDecoder |
createStreamDecoder() |
FSTEncoder |
createStreamEncoder() |
static FSTConfiguration |
createStructConfiguration()
special configuration used internally for struct emulation
|
<T> T |
deepCopy(T metadata) |
Object |
getCachedObject(Class cl) |
String |
getClassForCPName(String name) |
FSTClazzInfo |
getClassInfo(Class type) |
ClassLoader |
getClassLoader() |
FSTClazzNameRegistry |
getClassRegistry() |
FSTClazzInfo |
getClazzInfo(Class rowClass) |
FSTClazzInfoRegistry |
getCLInfoRegistry() |
String |
getCPNameForClass(Class cl)
get cross platform symbolic class identifier
|
byte[] |
getCrossPlatformBinaryCache(String symbolicName) |
static FSTConfiguration |
getDefaultConfiguration() |
FSTClassInstantiator |
getInstantiator(Class clazz) |
FSTObjectInput |
getObjectInput() |
FSTObjectInput |
getObjectInput(byte[] arr) |
FSTObjectInput |
getObjectInput(byte[] arr,
int len)
take the given array as input. the array is NOT copied
|
FSTObjectInput |
getObjectInput(InputStream in)
utility for thread safety and reuse.
|
FSTObjectOutput |
getObjectOutput() |
FSTObjectOutput |
getObjectOutput(byte[] outByte) |
FSTObjectOutput |
getObjectOutput(OutputStream out)
utility for thread safety and reuse.
|
FSTConfiguration.StreamCoderFactory |
getStreamCoderFactory() |
protected static FSTConfiguration |
initDefaultFstConfigurationInternal(FSTConfiguration conf) |
boolean |
isCrossPlatform() |
boolean |
isForceClzInit() |
boolean |
isForceSerializable() |
boolean |
isPreferSpeed()
ignored currently
|
boolean |
isShareReferences() |
boolean |
isStructMode()
special for structs
|
void |
registerClass(Class... c)
Preregister a class (use at init time).
|
void |
registerCrossPlatformClassBinaryCache(String fulLQName,
byte[] binary) |
void |
registerCrossPlatformClassMapping(String[][] keysAndVals)
init right after creation of configuration, not during operation as it is not threadsafe regarding mutation
currently only for minbin serialization
|
void |
registerCrossPlatformClassMapping(String shortName,
String fqName) |
void |
registerCrossPlatformClassMappingUseSimpleName(Class[] classes)
init right after creation of configuration, not during operation as it is not threadsafe regarding mutation
|
void |
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 |
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 |
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. set to null to delete.
|
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.
|
public boolean isForceClzInit()
public FSTConfiguration setForceClzInit(boolean forceClzInit)
forceClzInit - public FSTClassInstantiator getInstantiator(Class clazz)
public void setInstantiator(FSTClassInstantiator instantiator)
public static FSTConfiguration getDefaultConfiguration()
public void setClassLoader(ClassLoader classLoader)
public static FSTConfiguration createMinBinConfiguration()
public static FSTConfiguration createAndroidDefaultConfiguration()
public static FSTConfiguration createDefaultConfiguration()
protected static FSTConfiguration initDefaultFstConfigurationInternal(FSTConfiguration conf)
public static FSTConfiguration createFastBinaryConfiguration()
public void registerSerializer(Class clazz, FSTObjectSerializer ser, boolean alsoForAllSubclasses)
clazz - ser - alsoForAllSubclasses - 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 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)
public FSTObjectInput getObjectInput(byte[] arr, int len)
arr - len - 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 void registerCrossPlatformClassMapping(String[][] keysAndVals)
keysAndVals - { { "symbolicName", "fullQualifiedClazzName" }, .. }public void registerCrossPlatformClassMapping(String shortName, String fqName)
public void registerCrossPlatformClassMappingUseSimpleName(Class[] classes)
public void 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)
Copyright © 2015. All rights reserved.