public class FSTConfiguration extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FSTConfiguration.JacksonAccessWorkaround |
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.
|
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.
|
FSTConfiguration |
cpMap(String shortName,
Class clz)
shorthand for registerCrossPlatformClassMapping(_,_)
|
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 |
createJsonConfiguration() |
static FSTConfiguration |
createJsonConfiguration(boolean prettyPrint,
boolean shareReferences) |
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
|
Object |
decodeFromStream(InputStream in) |
<T> T |
deepCopy(T metadata) |
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() |
FSTClassInstantiator |
getInstantiator(Class clazz) |
FSTObjectInput |
getObjectInput() |
FSTObjectInput |
getObjectInput(byte[] arr) |
FSTObjectInput |
getObjectInput(byte[] arr,
int len)
take the given array as input.
|
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
|
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 |
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.
|
public boolean isForceClzInit()
public FSTConfiguration setForceClzInit(boolean forceClzInit)
forceClzInit - public FSTClassInstantiator getInstantiator(Class clazz)
public void setInstantiator(FSTClassInstantiator instantiator)
public static FSTConfiguration getDefaultConfiguration()
public static FSTConfiguration createMinBinConfiguration()
public static FSTConfiguration createJsonConfiguration()
public static FSTConfiguration createJsonConfiguration(boolean prettyPrint, boolean shareReferences)
public static void prettyPrintJson(Object o)
o - 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 <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 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 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 - ExceptionencodeToStreamCopyright © 2015. All rights reserved.