Package com.landawn.abacus.parser
Class KryoParser
java.lang.Object
com.landawn.abacus.parser.KryoParser
- All Implemented Interfaces:
Parser<KryoSerializationConfig,
KryoDeserializationConfig>
The content is encoded with Base64 if the target output is String or Writer, otherwise the content is NOT encoded with Base64 if the target output is File or OutputStream.
So content must be encoded with Base64 if the specified input is String or Reader, otherwise the content must NOT be encoded with Base64 if the specified input is File or InputStream.
The reason not to encoded the content with Base64 for File/OutputStream is to provide higher performance solution.
- Since:
- 0.8
- Author:
- Haiyang Li
-
Method Summary
Modifier and TypeMethodDescription<T> T
clone
(T obj) Copy the property values deeply.<T> T
copy
(T obj) Copy the property values shallowly.<T> T
decode
(byte[] bytes) <T> T
deserialize
(Class<? extends T> targetClass, File file) <T> T
deserialize
(Class<? extends T> targetClass, File file, KryoDeserializationConfig config) <T> T
deserialize
(Class<? extends T> targetClass, InputStream is) <T> T
deserialize
(Class<? extends T> targetClass, InputStream is, KryoDeserializationConfig config) <T> T
deserialize
(Class<? extends T> targetClass, Reader reader) <T> T
deserialize
(Class<? extends T> targetClass, Reader reader, KryoDeserializationConfig config) <T> T
deserialize
(Class<? extends T> targetClass, String st) <T> T
deserialize
(Class<? extends T> targetClass, String st, KryoDeserializationConfig config) byte[]
void
void
void
void
void
void
serialize
(File file, Object obj, KryoSerializationConfig config) void
serialize
(OutputStream os, Object obj) void
serialize
(OutputStream os, Object obj, KryoSerializationConfig config) void
void
serialize
(Writer writer, Object obj, KryoSerializationConfig config) serialize
(Object obj, KryoSerializationConfig config)
-
Method Details
-
serialize
- Parameters:
obj
-config
-- Returns:
- a Base64 encoded String
-
serialize
- Parameters:
file
- content is NOT encoded with base64obj
-config
-
-
serialize
- Parameters:
os
- content is NOT encoded with base64obj
-config
-
-
serialize
- Parameters:
writer
- content is encoded with base64obj
-config
-
-
deserialize
public <T> T deserialize(Class<? extends T> targetClass, String st, KryoDeserializationConfig config) - Type Parameters:
T
-- Parameters:
targetClass
-st
- A Base64 encoded Stringconfig
-- Returns:
-
deserialize
public <T> T deserialize(Class<? extends T> targetClass, File file, KryoDeserializationConfig config) - Type Parameters:
T
-- Parameters:
targetClass
-file
-config
-- Returns:
-
deserialize
public <T> T deserialize(Class<? extends T> targetClass, InputStream is, KryoDeserializationConfig config) - Type Parameters:
T
-- Parameters:
targetClass
-is
-config
-- Returns:
-
deserialize
public <T> T deserialize(Class<? extends T> targetClass, Reader reader, KryoDeserializationConfig config) - Type Parameters:
T
-- Parameters:
targetClass
-reader
- content is encoded with base64config
-- Returns:
-
copy
public <T> T copy(T obj) Copy the property values shallowly.- Type Parameters:
T
-- Parameters:
obj
-- Returns:
-
clone
public <T> T clone(T obj) Copy the property values deeply.- Type Parameters:
T
-- Parameters:
obj
-- Returns:
-
encode
- Parameters:
obj
-- Returns:
-
decode
public <T> T decode(byte[] bytes) - Type Parameters:
T
-- Parameters:
bytes
-- Returns:
-
register
- Parameters:
type
-
-
register
- Parameters:
type
-id
-
-
register
- Parameters:
type
-serializer
-
-
register
- Parameters:
type
-serializer
-id
-
-
serialize
- Specified by:
serialize
in interfaceParser<SC extends SerializationConfig<?>,
DC extends DeserializationConfig<?>> - Parameters:
obj
-- Returns:
-
serialize
- Specified by:
serialize
in interfaceParser<SC extends SerializationConfig<?>,
DC extends DeserializationConfig<?>> - Parameters:
file
-obj
-
-
serialize
- Specified by:
serialize
in interfaceParser<SC extends SerializationConfig<?>,
DC extends DeserializationConfig<?>> - Parameters:
os
-obj
-
-
serialize
- Specified by:
serialize
in interfaceParser<SC extends SerializationConfig<?>,
DC extends DeserializationConfig<?>> - Parameters:
writer
-obj
-
-
deserialize
- Specified by:
deserialize
in interfaceParser<SC extends SerializationConfig<?>,
DC extends DeserializationConfig<?>> - Type Parameters:
T
-- Parameters:
targetClass
-st
-- Returns:
-
deserialize
- Specified by:
deserialize
in interfaceParser<SC extends SerializationConfig<?>,
DC extends DeserializationConfig<?>> - Type Parameters:
T
-- Parameters:
targetClass
-file
-- Returns:
-
deserialize
- Specified by:
deserialize
in interfaceParser<SC extends SerializationConfig<?>,
DC extends DeserializationConfig<?>> - Type Parameters:
T
-- Parameters:
targetClass
-is
-- Returns:
-
deserialize
- Specified by:
deserialize
in interfaceParser<SC extends SerializationConfig<?>,
DC extends DeserializationConfig<?>> - Type Parameters:
T
-- Parameters:
targetClass
-reader
-- Returns:
-