Package org.drasyl.serialization
Class ByteArraySerializer
- java.lang.Object
-
- org.drasyl.serialization.ByteArraySerializer
-
- All Implemented Interfaces:
Serializer
public class ByteArraySerializer extends Object
This Serializer (de)serializes byte arrays (just returns the byte array unchanged/uncopied).
-
-
Constructor Summary
Constructors Constructor Description ByteArraySerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
fromByteArray(byte[] bytes, Class<T> type)
Produces an object of typeT
from an array of bytes.protected byte[]
matchedFromByteArray(byte[] bytes, Class<byte[]> type)
protected byte[]
matchedToByArray(byte[] o)
byte[]
toByteArray(Object o)
Serializes the given object into an array of bytes-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.drasyl.serialization.Serializer
fromByteArray
-
-
-
-
Method Detail
-
matchedToByArray
protected byte[] matchedToByArray(byte[] o)
-
matchedFromByteArray
protected byte[] matchedFromByteArray(byte[] bytes, Class<byte[]> type)
-
toByteArray
public byte[] toByteArray(Object o) throws IOException
Description copied from interface:Serializer
Serializes the given object into an array of bytes- Specified by:
toByteArray
in interfaceSerializer
- Throws:
IOException
- if deserialization from byte array fails
-
fromByteArray
public <T> T fromByteArray(byte[] bytes, Class<T> type) throws IOException
Description copied from interface:Serializer
Produces an object of typeT
from an array of bytes.- Specified by:
fromByteArray
in interfaceSerializer
- Throws:
IOException
- if serialization to byte array fails
-
-