return getReplicationStream(data,0,data.length);
}
public ReplicationStream getReplicationStream(byte[] data, int offset, int length) throws IOException {
ByteArrayInputStream fis =null;
ReplicationStream ois = null;
Loader loader = null;
ClassLoader classLoader = null;
//fix to be able to run the DeltaManager
//stand alone without a container.
//use the Threads context class loader
if (container != null)
loader = container.getLoader();
if (loader != null)
classLoader = loader.getClassLoader();
else
classLoader = Thread.currentThread().getContextClassLoader();
//end fix
fis = new ByteArrayInputStream(data, offset, length);
if ( classLoader == Thread.currentThread().getContextClassLoader() ) {
ois = new ReplicationStream(fis, new ClassLoader[] {classLoader});
} else {
ois = new ReplicationStream(fis, new ClassLoader[] {classLoader,Thread.currentThread().getContextClassLoader()});
}
return ois;
}