use of org.terasology.persistence.typeHandling.coreTypes.ByteArrayTypeHandler in project Terasology by MovingBlocks.
the class BytesTypeHandlerTest method byteArraySerializeDeserialize.
@Test
void byteArraySerializeDeserialize() {
byte[] expectedObj = new byte[] { (byte) 0xFF };
PersistedBytes data = serialize(expectedObj, new ByteArrayTypeHandler());
Assertions.assertEquals(expectedObj, data.getAsBytes());
byte[] obj = deserialize(data, new ByteArrayTypeHandler());
Assertions.assertEquals(expectedObj, obj);
}
use of org.terasology.persistence.typeHandling.coreTypes.ByteArrayTypeHandler in project Terasology by MovingBlocks.
the class TypeHandlerLibrary method populateBuiltInHandlers.
static void populateBuiltInHandlers(TypeHandlerLibrary typeHandlerLibrary) {
typeHandlerLibrary.addTypeHandler(Boolean.class, new BooleanTypeHandler());
typeHandlerLibrary.addTypeHandler(Boolean.TYPE, new BooleanTypeHandler());
typeHandlerLibrary.addTypeHandler(Byte.class, new ByteTypeHandler());
typeHandlerLibrary.addTypeHandler(Byte.TYPE, new ByteTypeHandler());
typeHandlerLibrary.addTypeHandler(Character.class, new CharacterTypeHandler());
typeHandlerLibrary.addTypeHandler(Character.TYPE, new CharacterTypeHandler());
typeHandlerLibrary.addTypeHandler(Double.class, new DoubleTypeHandler());
typeHandlerLibrary.addTypeHandler(Double.TYPE, new DoubleTypeHandler());
typeHandlerLibrary.addTypeHandler(Float.class, new FloatTypeHandler());
typeHandlerLibrary.addTypeHandler(Float.TYPE, new FloatTypeHandler());
typeHandlerLibrary.addTypeHandler(Integer.class, new IntTypeHandler());
typeHandlerLibrary.addTypeHandler(Integer.TYPE, new IntTypeHandler());
typeHandlerLibrary.addTypeHandler(Long.class, new LongTypeHandler());
typeHandlerLibrary.addTypeHandler(Long.TYPE, new LongTypeHandler());
typeHandlerLibrary.addTypeHandler(String.class, new StringTypeHandler());
typeHandlerLibrary.addTypeHandler(Number.class, new NumberTypeHandler());
typeHandlerLibrary.addTypeHandler(Locale.class, new LocaleTypeHandler());
typeHandlerLibrary.addTypeHandlerFactory(new ArrayTypeHandlerFactory());
typeHandlerLibrary.addTypeHandler(byte[].class, new ByteArrayTypeHandler());
typeHandlerLibrary.addTypeHandlerFactory(new EnumTypeHandlerFactory());
typeHandlerLibrary.addTypeHandlerFactory(new MapTypeHandlerFactory());
}
Aggregations