Example usage for org.apache.shiro.io Serializer serialize

List of usage examples for org.apache.shiro.io Serializer serialize

Introduction

In this page you can find the example usage for org.apache.shiro.io Serializer serialize.

Prototype

byte[] serialize(T o) throws SerializationException;

Source Link

Document

Converts the specified Object into a byte[] array.

Usage

From source file:com.flowlogix.services.test.PrincipalSerializationTests.java

License:Apache License

@Test
public void serializer() {
    final Serializer<X> ser = new DefaultSerializer<>();
    final String encoded = Base64.encodeToString(ser.serialize(new X(15, "xxx")));
    assertEquals(new X(15, "xxx"), ser.deserialize(Base64.decode(encoded)));
}