com.addc.commons.queue.ElementSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of addc-queues Show documentation
Show all versions of addc-queues Show documentation
The addc-queues library supplies support for internal persistent queues using an optional DERBY database for storage.
The newest version!
package com.addc.commons.queue;
import java.io.IOException;
/**
* The ElementSerializer Interface defines the contract for classes that know
* how to serialize and de-serialize items added to or removed from a
* {@link com.addc.commons.queue.persistence.PersistentQueue}.
*
*/
public interface ElementSerializer {
/**
* Serialize an item
*
* @param element
* The item to serialize
* @return The serialized item as a byte array
* @throws IOException
* If there is an I/O error
*/
byte[] serializeItem(E element) throws IOException;
/**
* De-serialize an item that was serialized with the serializeItem method
*
* @param data
* The byte array to get the item from
* @return The original item
* @throws IOException
* If there is an I/O error
* @throws ClassNotFoundException
* If the class of the data cannot be found
*/
E deserializeItem(byte[] data) throws IOException, ClassNotFoundException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy