public class Util extends Object
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static void |
checkPackageAccess(Class type)
Check for permission to access the package of the specified class.
|
static void |
checkProxyRemoteMethod(Class c,
Method m)
Throws IllegalArgumentException if any superinterface of c declares a
method with the same name and parameter types as m that does not
declare RemoteException or a superclass in its throws clause, or if
any superinterface of c has its name in prohibitedProxyInterfaces.
|
static boolean |
checkTrustEquivalence(Object subject,
Object object)
Returns true either if both arguments are null of if "subject"
is an instance of TrustEquivalence and an invocation of
TrustEquivalence.checkTrustEquivalence on "subject" with
"object" as the argument returns true; returns false otherwise.
|
static void |
clearStackTraces(Throwable t)
Clear the stack trace of the given exception by replacing it with
an empty StackTraceElement array, and do the same for all of its
chained causative exceptions.
|
static boolean |
equalInterfaces(Object obj1,
Object obj2)
Returns true if the interfaces implemented by obj1's class
are the same (and in the same order) as obj2's class.
|
static boolean |
equals(Object subject,
Object object)
Returns true either if both arguments are null or if an
invocation of Object.equals on "subject" with "object" as the
argument returns true; returns false otherwise;
|
static void |
exceptionReceivedFromServer(Throwable t)
Appends the current thread's stack trace to the stack trace of the
given exception.
|
static InetAddress |
getClientHost() |
static String |
getClientHostString() |
static Subject |
getClientSubject() |
static long |
getMethodHash(Method m)
Returns the method hash for the method
m . |
static String |
getMethodNameAndDescriptor(Method m)
Returns a string consisting of the given method's name followed by
its "method descriptor", as appropriate for use in the computation
of the "method hash".
|
static Class[] |
getRemoteInterfaces(Class remoteClass)
Returns an array containing the remote interfaces implemented
by the given class.
|
static String |
getUnqualifiedName(Class c)
Returns the binary name of the given type without package
qualification.
|
static void |
marshalValue(Class type,
Object value,
ObjectOutput out)
Marshals
value to an ObjectOutput stream,
out , using RMI's serialization format for arguments or
return values. |
static void |
populateContext(Collection context,
boolean integrity,
boolean atomic) |
static void |
populateContext(Collection context,
InetAddress addr) |
static void |
populateContext(Collection context,
Subject s) |
static boolean |
sameClassAndEquals(Object subject,
Object object)
Returns true either if both arguments are null or if both
arguments refer to objects of the same class and an invocation
of Object.equals on "subject" with "object" as the argument
returns true; returns false otherwise.
|
static boolean |
sameProxyClass(Object proxy1,
Object proxy2)
Returns true if proxy2 is a generated Proxy (proxy1 is assumed to
be one) and the classes of both proxies implement the same ordered
list of interfaces, and returns false otherwise.
|
static Object |
unmarshalValue(Class type,
ObjectInput in)
Unmarshals a value of the specified
type from the
ObjectInput stream, in , using RMI's
serialization format for arguments or return values and returns the
result. |
public static void exceptionReceivedFromServer(Throwable t)
public static void clearStackTraces(Throwable t)
public static void marshalValue(Class type, Object value, ObjectOutput out) throws IOException
value
to an ObjectOutput
stream,
out
, using RMI's serialization format for arguments or
return values. For primitive types, the primitive type's class should
be specified (i.e., for the type int
, specify
int.class
), and the primitive value should be wrapped in
instances of the appropriate wrapper class, such as
java.lang.Integer
or java.lang.Boolean
.type
- Class
object for the value to be marshalledvalue
- value to marshalout
- stream to which the value is marshalledIOException
- if an I/O error occurs marshalling
the value to the output streampublic static Object unmarshalValue(Class type, ObjectInput in) throws IOException, ClassNotFoundException
type
from the
ObjectInput
stream, in
, using RMI's
serialization format for arguments or return values and returns the
result. For primitive types, the primitive type's class should be
specified (i.e., for the primitive type int
, specify
int.class
).type
- Class
object for the value to be unmarshalledin
- stream from which the value is unmarshalledIOException
- if an I/O error occurs marshalling
the value to the output streamClassNotFoundException
- if the type
's
class could not be foundpublic static long getMethodHash(Method m)
m
. Subsequent
calls to getMethodHash
passing the same method argument
should be faster since this method caches internally the result of the
method to method hash mapping. The method hash is calculated using the
computeMethodHash
method.m
- the remote methodm
public static String getMethodNameAndDescriptor(Method m)
public static Class[] getRemoteInterfaces(Class remoteClass)
IllegalArgumentException
- if remoteClass implements
any illegal remote interfacesNullPointerException
- if remoteClass is nullpublic static void checkProxyRemoteMethod(Class c, Method m)
public static String getUnqualifiedName(Class c)
public static boolean equals(Object subject, Object object)
public static boolean sameClassAndEquals(Object subject, Object object)
public static boolean checkTrustEquivalence(Object subject, Object object)
public static boolean sameProxyClass(Object proxy1, Object proxy2)
public static boolean equalInterfaces(Object obj1, Object obj2)
public static void populateContext(Collection context, InetAddress addr)
public static void populateContext(Collection context, Subject s)
public static void populateContext(Collection context, boolean integrity, boolean atomic)
public static InetAddress getClientHost() throws ServerNotActiveException
ServerNotActiveException
public static String getClientHostString() throws ServerNotActiveException
ServerNotActiveException
public static Subject getClientSubject() throws ServerNotActiveException
ServerNotActiveException
public static void checkPackageAccess(Class type)
SecurityException
- if a security manager exists and invoking
its checkPackageAccess
method with the package name of
the specified class throws a SecurityException
Copyright © 2016–2018. All rights reserved.