}
result[actsize++] = e;
}
final FastMultiByteArrayOutputStream bos = new FastMultiByteArrayOutputStream();
final OutputStream os = compress ? new LZFOutputStream(bos) : bos;
final ObjectOutputStream oos;
try {
oos = new ObjectOutputStream(os);
oos.writeInt(actsize);
for(int i = 0; i < actsize; i++) {
oos.writeObject(result[i]);
result[i] = null;
}
oos.flush();
} catch (IOException e) {
throw new RemoteException("failed to serialize", e);
}
final byte[] ary = bos.toByteArray_clear();
try {
oos.close();
} catch (IOException e) {
throw new IllegalStateException(e);
}
return ary;
}