public class MarshalledWrapper extends Object implements Serializable
MarshalledInstance
that samples the integrity setting
(if any) of the stream it is unmarshalled from, and uses that setting to
determine whether or not to verify codebase integrity when calling the
get
method of the contained
MarshalledInstance
.Constructor and Description |
---|
MarshalledWrapper(AtomicSerial.GetArg arg) |
MarshalledWrapper(MarshalledInstance instance)
Creates a new
MarshalledWrapper wrapping the given
MarshalledInstance . |
MarshalledWrapper(Object obj)
Creates a new
MarshalledWrapper wrapping a
MarshalledInstance containing the given object. |
Modifier and Type | Method and Description |
---|---|
static boolean |
atomicityEnforced(ObjectStreamContext context)
Returns the atomicity protection setting of the given stream, determined
as follows: if the stream implements
ObjectStreamContext and has
in its context collection an object of type
AtomicValidationEnforcement , the
enforced method
of that object is called and the resulting value returned; otherwise,
false is returned. |
boolean |
equals(Object obj)
Compares the specified object with this
MarshalledWrapper
for equality. |
Object |
get()
Returns the result of calling the
get method of the wrapped MarshalledInstance , passing the
integrity value sampled during deserialization as the
verifyCodebaseIntegrity argument. |
Object |
get(ClassLoader defaultLoader,
ClassLoader verifierLoader)
Returns the result of calling the
get method of the wrapped MarshalledInstance , passing the
integrity value sampled during deserialization as the
verifyCodebaseIntegrity argument. |
boolean |
getIntegrity()
Returns the integrity value sampled during deserialization of this
MarshalledWrapper instance, or false if this
instance was not produced by deserialization or was deserialized from a
stream with no integrity protection setting. |
MarshalledInstance |
getMarshalledInstance()
Returns the
MarshalledInstance wrapped by this
MarshalledWrapper . |
int |
hashCode()
Returns the hash code value for this
MarshalledWrapper . |
static boolean |
integrityEnforced(ObjectInput stream)
Returns the integrity protection setting of the given stream, determined
as follows: if the stream implements
ObjectStreamContext and has
in its context collection an object of type
IntegrityEnforcement , the
integrityEnforced method
of that object is called and the resulting value returned; otherwise,
false is returned. |
static boolean |
integrityEnforced(ObjectStreamContext context)
Returns the integrity protection setting in the given ObjectStreamContext.
|
public MarshalledWrapper(Object obj) throws IOException
MarshalledWrapper
wrapping a
MarshalledInstance
containing the given object.obj
- object to create MarshalledInstance
withIOException
- if MarshalledInstance
creation failspublic MarshalledWrapper(MarshalledInstance instance)
MarshalledWrapper
wrapping the given
MarshalledInstance
.instance
- MarshalledInstance
to wrapNullPointerException
- if instance
is
null
public MarshalledWrapper(AtomicSerial.GetArg arg) throws IOException
IOException
public static boolean integrityEnforced(ObjectInput stream)
ObjectStreamContext
and has
in its context collection an object of type
IntegrityEnforcement
, the
integrityEnforced
method
of that object is called and the resulting value returned; otherwise,
false
is returned.stream
- the given streampublic static boolean integrityEnforced(ObjectStreamContext context)
context
- public static boolean atomicityEnforced(ObjectStreamContext context)
ObjectStreamContext
and has
in its context collection an object of type
AtomicValidationEnforcement
, the
enforced
method
of that object is called and the resulting value returned; otherwise,
false
is returned.context
- public Object get() throws IOException, ClassNotFoundException
get
method of the wrapped MarshalledInstance
, passing the
integrity value sampled during deserialization as the
verifyCodebaseIntegrity
argument. If this
MarshalledWrapper
instance was not produced by
deserialization or was deserialized from a stream with no integrity
protection setting, then a verifyCodebaseIntegrity
value of
false
is used.MarshalledInstance
IOException
- if an IOException
occurs during
unmarshallingClassNotFoundException
- if any classes necessary for
reconstructing the object being unmarshalled cannot be foundpublic Object get(ClassLoader defaultLoader, ClassLoader verifierLoader) throws IOException, ClassNotFoundException
get
method of the wrapped MarshalledInstance
, passing the
integrity value sampled during deserialization as the
verifyCodebaseIntegrity
argument. If this
MarshalledWrapper
instance was not produced by
deserialization or was deserialized from a stream with no integrity
protection setting, then a verifyCodebaseIntegrity
value of
false
is used.defaultLoader
- the class loader value (possibly
null
) to pass as the defaultLoader
argument to RMIClassLoader
methodsverifierLoader
- the class loader value (possibly
null
) to pass to Security.verifyCodebaseIntegrity
, if
verifyCodebaseIntegrity
is true
MarshalledInstance
IOException
- if an IOException
occurs during
unmarshallingClassNotFoundException
- if any classes necessary for
reconstructing the object being unmarshalled cannot be foundpublic MarshalledInstance getMarshalledInstance()
MarshalledInstance
wrapped by this
MarshalledWrapper
.MarshalledInstance
public boolean getIntegrity()
MarshalledWrapper
instance, or false
if this
instance was not produced by deserialization or was deserialized from a
stream with no integrity protection setting.public int hashCode()
MarshalledWrapper
.public boolean equals(Object obj)
MarshalledWrapper
for equality. This method returns true
if and only if the
specified object is of the same class as this object and its wrapped
MarshalledInstance
is equal to the one in this object.Copyright © 2016–2018. All rights reserved.