@Override public Collection getObjectStreamContext() { if (in instanceof ObjectStreamContext) { return ((ObjectStreamContext) in).getObjectStreamContext(); } return Collections.emptyList(); }
/** * Returns the integrity protection setting in the given ObjectStreamContext. * @param context * @return */ static boolean integrityEnforced(ObjectStreamContext context) { Collection ctx = context.getObjectStreamContext(); for (Iterator i = ctx.iterator(); i.hasNext(); ) { Object obj = i.next(); if (obj instanceof IntegrityEnforcement) { return ((IntegrityEnforcement) obj).integrityEnforced(); } } return false; }
/** * Returns the integrity protection setting in the given ObjectStreamContext. * @param context * @return */ public static boolean integrityEnforced(ObjectStreamContext context) { Collection ctx = context.getObjectStreamContext(); for (Iterator i = ctx.iterator(); i.hasNext(); ) { Object obj = i.next(); if (obj instanceof IntegrityEnforcement) { return ((IntegrityEnforcement) obj).integrityEnforced(); } } return false; }
/** * Returns the atomicity protection setting of the given stream, determined * as follows: if the stream implements {@link ObjectStreamContext} and has * in its context collection an object of type * {@link AtomicValidationEnforcement}, the * {@link AtomicValidationEnforcement#enforced enforced} method * of that object is called and the resulting value returned; otherwise, * <code>false</code> is returned. * * @param context * @return integrity protection setting of the given stream */ public static boolean atomicityEnforced(ObjectStreamContext context) { Collection ctx = ((ObjectStreamContext) context).getObjectStreamContext(); for (Iterator i = ctx.iterator(); i.hasNext(); ) { Object obj = i.next(); if (obj instanceof AtomicValidationEnforcement) { return ((AtomicValidationEnforcement) obj).enforced(); } } return false; }
/** * Returns the atomicity protection setting of the given stream, determined * as follows: if the stream implements {@link ObjectStreamContext} and has * in its context collection an object of type * {@link AtomicValidationEnforcement}, the * {@link AtomicValidationEnforcement#enforced enforced} method * of that object is called and the resulting value returned; otherwise, * <code>false</code> is returned. * * @param context * @return integrity protection setting of the given stream */ static boolean atomicityEnforced(ObjectStreamContext context) { Collection ctx = ((ObjectStreamContext) context).getObjectStreamContext(); for (Iterator i = ctx.iterator(); i.hasNext(); ) { Object obj = i.next(); if (obj instanceof AtomicValidationEnforcement) { return ((AtomicValidationEnforcement) obj).enforced(); } } return false; }
/** * Returns the integrity protection setting of the given stream, determined as follows: if the * stream implements {@link ObjectStreamContext} and has in its context collection an object of * type {@link IntegrityEnforcement}, the {@link IntegrityEnforcement#integrityEnforced * integrityEnforced} method of that object is called and the resulting value returned; * otherwise, <code>false</code> is returned. * * @return integrity protection setting of the given stream */ public static boolean integrityEnforced(ObjectInputStream stream) { if (stream instanceof ObjectStreamContext) { Collection ctx = ((ObjectStreamContext) stream).getObjectStreamContext(); for (Iterator i = ctx.iterator(); i.hasNext(); ) { Object obj = i.next(); if (obj instanceof IntegrityEnforcement) { return ((IntegrityEnforcement) obj).integrityEnforced(); } } } return false; }