Search in sources :

Example 1 with ExceptionReplacingObjectOutputStream

use of org.gradle.internal.serialize.ExceptionReplacingObjectOutputStream in project gradle by gradle.

the class InProcessWorkerFactory method transferResultFromWorkerClassLoader.

private DefaultWorkResult transferResultFromWorkerClassLoader(Object result) throws IOException, ClassNotFoundException {
    ByteArrayOutputStream resultBytes = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ExceptionReplacingObjectOutputStream(resultBytes);
    try {
        oos.writeObject(result);
    } finally {
        oos.close();
    }
    ObjectInputStream ois = new ExceptionReplacingObjectInputStream(new ByteArrayInputStream(resultBytes.toByteArray()), getClass().getClassLoader());
    return (DefaultWorkResult) ois.readObject();
}
Also used : ExceptionReplacingObjectInputStream(org.gradle.internal.serialize.ExceptionReplacingObjectInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) ExceptionReplacingObjectOutputStream(org.gradle.internal.serialize.ExceptionReplacingObjectOutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) ExceptionReplacingObjectOutputStream(org.gradle.internal.serialize.ExceptionReplacingObjectOutputStream) ObjectInputStream(java.io.ObjectInputStream) ClassLoaderObjectInputStream(org.gradle.internal.io.ClassLoaderObjectInputStream) ExceptionReplacingObjectInputStream(org.gradle.internal.serialize.ExceptionReplacingObjectInputStream)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 ClassLoaderObjectInputStream (org.gradle.internal.io.ClassLoaderObjectInputStream)1 ExceptionReplacingObjectInputStream (org.gradle.internal.serialize.ExceptionReplacingObjectInputStream)1 ExceptionReplacingObjectOutputStream (org.gradle.internal.serialize.ExceptionReplacingObjectOutputStream)1