Home   Info   DevZone   Wiki  
UsersWeb  |  MainWeb  |  InfoWeb  |  DevZoneWeb  |  SupportWeb
AlterKitInfo ] [ not logged in ] [ Web: Imported ] goto:  options
[ get info on or edit ] login or new user ] [ list of topics, hubs & nodes, or recent changes ]

AlterKit: As the name suggests, the AlterKit utility begins with the AlterKit interface. This interface consists of two sets of methods. Firstly:

public abstract byte[] alterObject(Object object)

which converts an object to an 'altered' byte array and

public abstract Object restoreObject(byte buf[])

which converts an 'altered' byte array back into an object.

Secondly is the set/get AlterMethod methods:

public abstract void setAlterMethod(AlterMethod alterMethod)

public abstract AlterMethod getAlterMethod()

which sets and retrieves the method by which object is altered between states.

For example, if the AlterMethod did not alter the conversion in anyway, alterObject would convert 'object' into a serialized byte array (exactly like java.io.ObjectOutputStream).

AlterMethod: AlterMethods also consists of two sets of methods.

public abstract void setAlterMethod(AlterMethod am)

public abstract AlterMethod getAlterMethod()

which basically allow AlterMethods to be cascaded and any combination of conversions and encryptions possible and

public abstract OutputStream getOutputStream(OutputStream os)

public abstract InputStream getInputStream(InputStream is)

These last two methods are the workhorses of AlterKit. It is inside these methods that the conversion of byte arrays (not objects) takes place. For example, a GZIP compression AlterMethod, will use java.util.zip.GZIPOutputStream and GZIPInputStream.

Some abstract implementations have been created of these interfaces and the rest are default concrete implementations of them.

StefanBorg Created: 4-Jul-98

Return to AlterKit


Content of these pages are owned and copyrighted by the poster.
Hosted by: