/** * * @param obj Object to be marshaled. * @param context * @param factory MarshalFactory used to create MarshalIntstanceOutput * @param bout ByteArrayOutputStream to write object serial form. * @param lout ByteArrayOutputStream to write code-base annotation to. * @return byte array of location. * @throws IOException */ private static byte[] writeOutRetLocAnnotation(Object obj, Collection context, MarshalFactory factory, ByteArrayOutputStream bout, ByteArrayOutputStream lout) throws IOException { if (context == null) throw new NullPointerException(); if (factory == null) throw new NullPointerException(); MarshalInstanceOutput out = null; try { out = factory.createMarshalOutput(bout, lout, context); out.writeObject(obj); out.flush(); // locBytes is null if no annotations return out.hadAnnotations() ? lout.toByteArray() : null; } finally { try { if (out != null) out.close(); } catch (IOException e){} // Ignore } }
in = getMarshalFactory().createMarshalInput( bin, lin, defaultLoader, verifyCodebaseIntegrity, verifierLoader, ctext);