java.io.ObjectInputStream.resolveProxyClass()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(11.3k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中java.io.ObjectInputStream.resolveProxyClass()方法的一些代码示例,展示了ObjectInputStream.resolveProxyClass()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectInputStream.resolveProxyClass()方法的具体详情如下:
包路径:java.io.ObjectInputStream
类名称:ObjectInputStream
方法名:resolveProxyClass

ObjectInputStream.resolveProxyClass介绍

[英]Creates the proxy class that implements the interfaces specified in interfaceNames.
[中]创建实现InterfaceName中指定的接口的代理类。

代码示例

代码示例来源:origin: commons-io/commons-io

/**
 * Create a proxy class that implements the specified interfaces using
 * the specified ClassLoader or the super ClassLoader.
 *
 * @param interfaces the interfaces to implement
 * @return a proxy class implementing the interfaces
 * @throws IOException in case of an I/O error
 * @throws ClassNotFoundException if the Class cannot be found
 * @see java.io.ObjectInputStream#resolveProxyClass(java.lang.String[])
 * @since 2.1
 */
@Override
protected Class<?> resolveProxyClass(final String[] interfaces) throws IOException,
    ClassNotFoundException {
  final Class<?>[] interfaceClasses = new Class[interfaces.length];
  for (int i = 0; i < interfaces.length; i++) {
    interfaceClasses[i] = Class.forName(interfaces[i], false, classLoader);
  }
  try {
    return Proxy.getProxyClass(classLoader, interfaceClasses);
  } catch (final IllegalArgumentException e) {
    return super.resolveProxyClass(interfaces);
  }
}

代码示例来源:origin: apache/flink

return super.resolveProxyClass(interfaces);

代码示例来源:origin: com.alibaba/fastjson

protected Class<?> resolveProxyClass(String[] interfaces)
    throws IOException, ClassNotFoundException {
  for (String interfacename : interfaces) {
    //检查是否处于黑名单
    ParserConfig.global.checkAutoType(interfacename, null);
  }
  return super.resolveProxyClass(interfaces);
}

代码示例来源:origin: find-sec-bugs/find-sec-bugs

/**
   * Create a proxy class that implements the specified interfaces using
   * the specified ClassLoader or the super ClassLoader.
   *
   * @param interfaces the interfaces to implement
   * @return a proxy class implementing the interfaces
   * @throws IOException            in case of an I/O error
   * @throws ClassNotFoundException if the Class cannot be found
   * @see java.io.ObjectInputStream#resolveProxyClass(java.lang.String[])
   * @since 2.1
   */
  @Override
  protected Class<?> resolveProxyClass(final String[] interfaces) throws IOException,
      ClassNotFoundException {
    final Class<?>[] interfaceClasses = new Class[interfaces.length];
    for (int i = 0; i < interfaces.length; i++) {
      interfaceClasses[i] = Class.forName(interfaces[i], false, classLoader);
    }
    try {
      return Proxy.getProxyClass(classLoader, interfaceClasses);
    } catch (final IllegalArgumentException e) {
      return super.resolveProxyClass(interfaces);
    }
  }
}

代码示例来源:origin: robovm/robovm

/**
 * Reads a new proxy class descriptor from the receiver. It is assumed the
 * proxy class descriptor has not been read yet (not a cyclic reference).
 * Return the proxy class descriptor read.
 *
 * @return The {@code Class} read from the stream.
 *
 * @throws IOException
 *             If an IO exception happened when reading the class
 *             descriptor.
 * @throws ClassNotFoundException
 *             If a class for one of the objects could not be found
 */
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
    IOException {
  int count = input.readInt();
  String[] interfaceNames = new String[count];
  for (int i = 0; i < count; i++) {
    interfaceNames[i] = input.readUTF();
  }
  Class<?> proxy = resolveProxyClass(interfaceNames);
  // Consume unread class annotation data and TC_ENDBLOCKDATA
  discardData();
  return proxy;
}

代码示例来源:origin: spring-projects/spring-framework

return super.resolveProxyClass(interfaces);

代码示例来源:origin: org.springframework/spring-core

return super.resolveProxyClass(interfaces);

代码示例来源:origin: camunda/camunda-bpm-platform

return super.resolveProxyClass(interfaces);

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Create a proxy class that implements the specified interfaces using
 * the specified ClassLoader or the super ClassLoader.
 *
 * @param interfaces the interfaces to implement
 * @return a proxy class implementing the interfaces
 * @throws IOException in case of an I/O error
 * @throws ClassNotFoundException if the Class cannot be found
 * @see java.io.ObjectInputStream#resolveProxyClass(java.lang.String[])
 * @since 2.1
 */
@Override
protected Class<?> resolveProxyClass(final String[] interfaces) throws IOException,
    ClassNotFoundException {
  final Class<?>[] interfaceClasses = new Class[interfaces.length];
  for (int i = 0; i < interfaces.length; i++) {
    interfaceClasses[i] = Class.forName(interfaces[i], false, classLoader);
  }
  try {
    return Proxy.getProxyClass(classLoader, interfaceClasses);
  } catch (final IllegalArgumentException e) {
    return super.resolveProxyClass(interfaces);
  }
}

代码示例来源:origin: org.onosproject/onlab-thirdparty

/**
 * Create a proxy class that implements the specified interfaces using
 * the specified ClassLoader or the super ClassLoader.
 *
 * @param interfaces the interfaces to implement
 * @return a proxy class implementing the interfaces
 * @throws IOException in case of an I/O error
 * @throws ClassNotFoundException if the Class cannot be found
 * @see java.io.ObjectInputStream#resolveProxyClass(java.lang.String[])
 * @since 2.1
 */
@Override
protected Class<?> resolveProxyClass(String[] interfaces) throws IOException,
    ClassNotFoundException {
  Class<?>[] interfaceClasses = new Class[interfaces.length];
  for (int i = 0; i < interfaces.length; i++) {
    interfaceClasses[i] = Class.forName(interfaces[i], false, classLoader);
  }
  try {
    return Proxy.getProxyClass(classLoader, interfaceClasses);
  } catch (IllegalArgumentException e) {
    return super.resolveProxyClass(interfaces);
  }
}

代码示例来源:origin: com.aliyun.openservices/ons-client

protected Class<?> resolveProxyClass(String[] interfaces)
throws IOException, ClassNotFoundException {
  for (String interfacename : interfaces) {
    //检查是否处于黑名单
    ParserConfig.global.checkAutoType(interfacename, null);
  }
  return super.resolveProxyClass(interfaces);
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Create a proxy class that implements the specified interfaces using
 * the specified ClassLoader or the super ClassLoader.
 *
 * @param interfaces the interfaces to implement
 * @return a proxy class implementing the interfaces
 * @throws IOException in case of an I/O error
 * @throws ClassNotFoundException if the Class cannot be found
 * @see java.io.ObjectInputStream#resolveProxyClass(java.lang.String[])
 * @since 2.1
 */
@Override
protected Class<?> resolveProxyClass(String[] interfaces) throws IOException,
    ClassNotFoundException {
  Class<?>[] interfaceClasses = new Class[interfaces.length];
  for (int i = 0; i < interfaces.length; i++) {
    interfaceClasses[i] = Class.forName(interfaces[i], false, classLoader);
  }
  try {
    return Proxy.getProxyClass(classLoader, interfaceClasses);
  } catch (IllegalArgumentException e) {
    return super.resolveProxyClass(interfaces);
  }
}

代码示例来源:origin: arquillian/arquillian-core

@Override
protected Class<?> resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException {
  return super.resolveProxyClass(interfaces);
}

代码示例来源:origin: org.glassfish.main.common/container-common

@Override
protected Class<?> resolveProxyClass(String[] interfaces)
  throws IOException, ClassNotFoundException
{
  Class<?>[] classObjs = new Class[interfaces.length];
  for (int i = 0; i < interfaces.length; i++) {
    Class<?> cl = Class.forName(interfaces[i], false, appLoader);
    // If any non-public interfaces, delegate to JDK's
    // implementation of resolveProxyClass.
    if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
      return super.resolveProxyClass(interfaces);
    } else {
      classObjs[i] = cl;
    }
  }
  try {
    return Proxy.getProxyClass(appLoader, classObjs);
  } catch (IllegalArgumentException e) {
    throw new ClassNotFoundException(null, e);
  }
}

代码示例来源:origin: org.glassfish.ejb/ejb-container

@Override
protected Class resolveProxyClass(String[] interfaces)
  throws IOException, ClassNotFoundException
{
  Class[] classObjs = new Class[interfaces.length];
  for (int i = 0; i < interfaces.length; i++) {
    Class cl = Class.forName(interfaces[i], false, appLoader);
    // If any non-public interfaces, delegate to JDK's
    // implementation of resolveProxyClass.
    if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
      return super.resolveProxyClass(interfaces);
    } else {
      classObjs[i] = cl;
    }
  }
  try {
    return Proxy.getProxyClass(appLoader, classObjs);
  } catch (IllegalArgumentException e) {
    throw new ClassNotFoundException(null, e);
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * Reads a new proxy class descriptor from the receiver. It is assumed the
 * proxy class descriptor has not been read yet (not a cyclic reference).
 * Return the proxy class descriptor read.
 *
 * @return The {@code Class} read from the stream.
 *
 * @throws IOException
 *             If an IO exception happened when reading the class
 *             descriptor.
 * @throws ClassNotFoundException
 *             If a class for one of the objects could not be found
 */
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
    IOException {
  int count = input.readInt();
  String[] interfaceNames = new String[count];
  for (int i = 0; i < count; i++) {
    interfaceNames[i] = input.readUTF();
  }
  Class<?> proxy = resolveProxyClass(interfaceNames);
  // Consume unread class annotation data and TC_ENDBLOCKDATA
  discardData();
  return proxy;
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Reads a new proxy class descriptor from the receiver. It is assumed the
 * proxy class descriptor has not been read yet (not a cyclic reference).
 * Return the proxy class descriptor read.
 *
 * @return The {@code Class} read from the stream.
 * @throws IOException            If an IO exception happened when reading the class
 *                                descriptor.
 * @throws ClassNotFoundException If a class for one of the objects could not be found
 */
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
  IOException {
  int count = input.readInt();
  String[] interfaceNames = new String[count];
  for (int i = 0; i < count; i++) {
    interfaceNames[i] = input.readUTF();
  }
  Class<?> proxy = resolveProxyClass(interfaceNames);
  // Consume unread class annotation data and TC_ENDBLOCKDATA
  discardData();
  return proxy;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Reads a new proxy class descriptor from the receiver. It is assumed the
 * proxy class descriptor has not been read yet (not a cyclic reference).
 * Return the proxy class descriptor read.
 *
 * @return The {@code Class} read from the stream.
 *
 * @throws IOException
 *             If an IO exception happened when reading the class
 *             descriptor.
 * @throws ClassNotFoundException
 *             If a class for one of the objects could not be found
 */
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
    IOException {
  int count = input.readInt();
  String[] interfaceNames = new String[count];
  for (int i = 0; i < count; i++) {
    interfaceNames[i] = input.readUTF();
  }
  Class<?> proxy = resolveProxyClass(interfaceNames);
  // Consume unread class annotation data and TC_ENDBLOCKDATA
  discardData();
  return proxy;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Reads a new proxy class descriptor from the receiver. It is assumed the
 * proxy class descriptor has not been read yet (not a cyclic reference).
 * Return the proxy class descriptor read.
 *
 * @return The {@code Class} read from the stream.
 *
 * @throws IOException
 *             If an IO exception happened when reading the class
 *             descriptor.
 * @throws ClassNotFoundException
 *             If a class for one of the objects could not be found
 */
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
    IOException {
  int count = input.readInt();
  String[] interfaceNames = new String[count];
  for (int i = 0; i < count; i++) {
    interfaceNames[i] = input.readUTF();
  }
  Class<?> proxy = resolveProxyClass(interfaceNames);
  // Consume unread class annotation data and TC_ENDBLOCKDATA
  discardData();
  return proxy;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Reads a new proxy class descriptor from the receiver. It is assumed the
 * proxy class descriptor has not been read yet (not a cyclic reference).
 * Return the proxy class descriptor read.
 *
 * @return The {@code Class} read from the stream.
 *
 * @throws IOException
 *             If an IO exception happened when reading the class
 *             descriptor.
 * @throws ClassNotFoundException
 *             If a class for one of the objects could not be found
 */
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
    IOException {
  int count = input.readInt();
  String[] interfaceNames = new String[count];
  for (int i = 0; i < count; i++) {
    interfaceNames[i] = input.readUTF();
  }
  Class<?> proxy = resolveProxyClass(interfaceNames);
  // Consume unread class annotation data and TC_ENDBLOCKDATA
  discardData();
  return proxy;
}

相关文章

ObjectInputStream类方法