Package io.microsphere.io
Interface Serializer<S>
-
- Type Parameters:
S
- the type of the object that will be serialized
- All Known Implementing Classes:
DefaultSerializer
,StringSerializer
public interface Serializer<S>
A strategy interface for serializing objects of typeS
into a byte array.Implementations of this interface must be thread-safe and should also ensure that the serialization process is consistent and efficient.
Example Usage
public class StringSerializer implements Serializer<String> { public byte[] serialize(String source) throws IOException { return source.getBytes(StandardCharsets.UTF_8); } }
- Since:
- 1.0.0
- Author:
- Mercy
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]
serialize(S source)
-
-
-
Method Detail
-
serialize
byte[] serialize(S source) throws java.io.IOException
- Throws:
java.io.IOException
-
-