Search in sources :

Example 1 with ClassLoaderObjectInputStream

use of io.fabric8.dosgi.util.ClassLoaderObjectInputStream in project fabric8 by jboss-fuse.

the class ObjectSerializationStrategy method decodeResponse.

public void decodeResponse(ClassLoader loader, Class<?> type, DataByteArrayInputStream source, AsyncCallback result) throws IOException, ClassNotFoundException {
    ClassLoaderObjectInputStream ois = new ClassLoaderObjectInputStream(source);
    ois.setClassLoader(loader);
    Throwable error = (Throwable) ois.readObject();
    Object value = ois.readObject();
    if (error != null) {
        result.onFailure(error);
    } else {
        result.onSuccess(value);
    }
}
Also used : ClassLoaderObjectInputStream(io.fabric8.dosgi.util.ClassLoaderObjectInputStream)

Example 2 with ClassLoaderObjectInputStream

use of io.fabric8.dosgi.util.ClassLoaderObjectInputStream in project fabric8 by jboss-fuse.

the class ObjectSerializationStrategy method decodeRequest.

public void decodeRequest(ClassLoader loader, Class<?>[] types, DataByteArrayInputStream source, Object[] target) throws IOException, ClassNotFoundException {
    final ClassLoaderObjectInputStream ois = new ClassLoaderObjectInputStream(source);
    ois.setClassLoader(loader);
    final Object[] args = (Object[]) ois.readObject();
    if (args != null) {
        System.arraycopy(args, 0, target, 0, args.length);
    }
}
Also used : ClassLoaderObjectInputStream(io.fabric8.dosgi.util.ClassLoaderObjectInputStream)

Aggregations

ClassLoaderObjectInputStream (io.fabric8.dosgi.util.ClassLoaderObjectInputStream)2