org.jppf.data.transform
Class JPPFDataTransformFactory

java.lang.Object
  extended by org.jppf.data.transform.JPPFDataTransformFactory

public class JPPFDataTransformFactory
extends Object

Factory class for data transform. The class of the actual JPPFDataTransform implementation is specified via the configuration property "jppf.data.transform.class = fully qualified class name". If the class cannot be found, or none is specified, then no transformation takes place.

Author:
Laurent Cohen

Constructor Summary
JPPFDataTransformFactory()
           
 
Method Summary
static JPPFDataTransform getInstance()
          Get an instance of the configured data transform.
static byte[] transform(boolean normal, byte[] data)
          Transform the specified data using a new data transformation instance.
static byte[] transform(boolean normal, byte[] data, int offset, int len)
          Transform the specified data using a new data transformation instance.
static byte[] transform(boolean normal, InputStream is)
          Transform the specified data using a new data transformation instance.
static byte[] transform(JPPFDataTransform transform, boolean normal, byte[] data)
          Transform the specified data using the specified data transformation.
static byte[] transform(JPPFDataTransform transform, boolean normal, byte[] data, int offset, int len)
          Transform the specified data using the specified data transformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPPFDataTransformFactory

public JPPFDataTransformFactory()
Method Detail

getInstance

public static JPPFDataTransform getInstance()
Get an instance of the configured data transform. This method creates a new instance every time it is invoked.

Returns:
an instance of JPPFDataTransform.

transform

public static byte[] transform(JPPFDataTransform transform,
                               boolean normal,
                               byte[] data,
                               int offset,
                               int len)
                        throws Exception
Transform the specified data using the specified data transformation.

Parameters:
transform - the data transformation to use.
normal - true to wrap the data, false to unwrap it.
data - the data to transform.
offset - the position to start a in the data.
len - the number of bytes to process, starting at the offset, in the data.
Returns:
the result of the transformation as an array of bytes.
Throws:
Exception - if any error occurs while transforming the data.

transform

public static byte[] transform(JPPFDataTransform transform,
                               boolean normal,
                               byte[] data)
                        throws Exception
Transform the specified data using the specified data transformation.

Parameters:
transform - the data transformation to use.
normal - true to wrap the data, false to unwrap it.
data - the data to transform.
Returns:
the result of the transformation as an array of bytes.
Throws:
Exception - if any error occurs while transforming the data.

transform

public static byte[] transform(boolean normal,
                               byte[] data,
                               int offset,
                               int len)
                        throws Exception
Transform the specified data using a new data transformation instance.

Parameters:
normal - true to wrap the data, false to unwrap it.
data - the data to transform.
offset - the position to start a in the data.
len - the number of bytes to process, starting at the offset, in the data.
Returns:
the result of the transformation as an array of bytes, or the original data if no data transform is configured.
Throws:
Exception - if any error occurs while transforming the data.
Exception - if any error occurs while tranforming the data.

transform

public static byte[] transform(boolean normal,
                               byte[] data)
                        throws Exception
Transform the specified data using a new data transformation instance.

Parameters:
normal - true to wrap the data, false to unwrap it.
data - the data to transform.
Returns:
the result of the transformation as an array of bytes, or the original data if no data transform is configured.
Throws:
Exception - if any error occurs while transforming the data.

transform

public static byte[] transform(boolean normal,
                               InputStream is)
                        throws Exception
Transform the specified data using a new data transformation instance.

Parameters:
normal - true to wrap the data, false to unwrap it.
is - the data to transform.
Returns:
the result of the transformation as an array of bytes, or the original data if no data transform is configured.
Throws:
Exception - if any error occurs while transforming the data.


Copyright © 2005-2010 JPPF Team.