java.net.URLClassLoader.getHandler()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(12.4k)|赞(0)|评价(0)|浏览(85)

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

URLClassLoader.getHandler介绍

暂无

代码示例

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

/**
 * Returns all known URLs which point to the specified resource.
 *
 * @param name
 *            the name of the requested resource.
 * @return the enumeration of URLs which point to the specified resource.
 * @throws IOException
 *             if an I/O error occurs while attempting to connect.
 */
@Override
public Enumeration<URL> findResources(final String name) throws IOException {
  if (name == null) {
    return null;
  }
  ArrayList<URL> result = new ArrayList<URL>();
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    handler.findResources(name, result);
  }
  return Collections.enumeration(result);
}

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

/**
 * Returns an URL referencing the specified resource or {@code null} if the
 * resource could not be found.
 *
 * @param name
 *            the name of the requested resource.
 * @return the URL which points to the given resource.
 */
@Override
public URL findResource(final String name) {
  if (name == null) {
    return null;
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    URL res = handler.findResource(name);
    if (res != null) {
      return res;
    }
  }
  return null;
}

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

/**
 * Tries to locate and load the specified class using the known URLs. If the
 * class could be found, a class object representing the loaded class will
 * be returned.
 *
 * @throws ClassNotFoundException
 *             if the specified class cannot be loaded.
 */
@Override
protected Class<?> findClass(final String className) throws ClassNotFoundException {
  String partialName = className.replace('.', '/');
  final String classFileName = new StringBuilder(partialName).append(".class").toString();
  String packageName = null;
  int position = partialName.lastIndexOf('/');
  if ((position = partialName.lastIndexOf('/')) != -1) {
    packageName = partialName.substring(0, position);
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    Class<?> res = handler.findClass(packageName, classFileName, className);
    if (res != null) {
      return res;
    }
  }
  throw new ClassNotFoundException(className);
}

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

/**
 * Tries to locate and load the specified class using the known URLs. If the
 * class could be found, a class object representing the loaded class will
 * be returned.
 *
 * @throws ClassNotFoundException
 *             if the specified class cannot be loaded.
 */
@Override
protected Class<?> findClass(final String className) throws ClassNotFoundException {
  String partialName = className.replace('.', '/');
  final String classFileName = new StringBuilder(partialName).append(".class").toString();
  String packageName = null;
  int position = partialName.lastIndexOf('/');
  if ((position = partialName.lastIndexOf('/')) != -1) {
    packageName = partialName.substring(0, position);
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    Class<?> res = handler.findClass(packageName, classFileName, className);
    if (res != null) {
      return res;
    }
  }
  throw new ClassNotFoundException(className);
}

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

/**
 * Returns all known URLs which point to the specified resource.
 *
 * @param name
 *            the name of the requested resource.
 * @return the enumeration of URLs which point to the specified resource.
 * @throws IOException
 *             if an I/O error occurs while attempting to connect.
 */
@Override
public Enumeration<URL> findResources(final String name) throws IOException {
  if (name == null) {
    return null;
  }
  ArrayList<URL> result = new ArrayList<URL>();
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    handler.findResources(name, result);
  }
  return Collections.enumeration(result);
}

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

/**
 * Returns an URL referencing the specified resource or {@code null} if the
 * resource could not be found.
 *
 * @param name
 *            the name of the requested resource.
 * @return the URL which points to the given resource.
 */
@Override
public URL findResource(final String name) {
  if (name == null) {
    return null;
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    URL res = handler.findResource(name);
    if (res != null) {
      return res;
    }
  }
  return null;
}

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

/**
 * Returns all known URLs which point to the specified resource.
 *
 * @param name
 *            the name of the requested resource.
 * @return the enumeration of URLs which point to the specified resource.
 * @throws IOException
 *             if an I/O error occurs while attempting to connect.
 */
@Override
public Enumeration<URL> findResources(final String name) throws IOException {
  if (name == null) {
    return null;
  }
  ArrayList<URL> result = new ArrayList<URL>();
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    handler.findResources(name, result);
  }
  return Collections.enumeration(result);
}

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

/**
 * Returns all known URLs which point to the specified resource.
 *
 * @param name
 *            the name of the requested resource.
 * @return the enumeration of URLs which point to the specified resource.
 * @throws IOException
 *             if an I/O error occurs while attempting to connect.
 */
@Override
public Enumeration<URL> findResources(final String name) throws IOException {
  if (name == null) {
    return null;
  }
  ArrayList<URL> result = new ArrayList<URL>();
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    handler.findResources(name, result);
  }
  return Collections.enumeration(result);
}

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

/**
 * Returns an URL referencing the specified resource or {@code null} if the
 * resource could not be found.
 *
 * @param name
 *            the name of the requested resource.
 * @return the URL which points to the given resource.
 */
@Override
public URL findResource(final String name) {
  if (name == null) {
    return null;
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    URL res = handler.findResource(name);
    if (res != null) {
      return res;
    }
  }
  return null;
}

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

/**
 * Returns all known URLs which point to the specified resource.
 *
 * @param name
 *            the name of the requested resource.
 * @return the enumeration of URLs which point to the specified resource.
 * @throws IOException
 *             if an I/O error occurs while attempting to connect.
 */
@Override
public Enumeration<URL> findResources(final String name) throws IOException {
  if (name == null) {
    return null;
  }
  ArrayList<URL> result = new ArrayList<URL>();
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    handler.findResources(name, result);
  }
  return Collections.enumeration(result);
}

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

/**
 * Tries to locate and load the specified class using the known URLs. If the
 * class could be found, a class object representing the loaded class will
 * be returned.
 *
 * @throws ClassNotFoundException
 *             if the specified class cannot be loaded.
 */
@Override
protected Class<?> findClass(final String className) throws ClassNotFoundException {
  String partialName = className.replace('.', '/');
  final String classFileName = new StringBuilder(partialName).append(".class").toString();
  String packageName = null;
  int position = partialName.lastIndexOf('/');
  if ((position = partialName.lastIndexOf('/')) != -1) {
    packageName = partialName.substring(0, position);
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    Class<?> res = handler.findClass(packageName, classFileName, className);
    if (res != null) {
      return res;
    }
  }
  throw new ClassNotFoundException(className);
}

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

/**
 * Returns an URL referencing the specified resource or {@code null} if the
 * resource could not be found.
 *
 * @param name
 *            the name of the requested resource.
 * @return the URL which points to the given resource.
 */
@Override
public URL findResource(final String name) {
  if (name == null) {
    return null;
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    URL res = handler.findResource(name);
    if (res != null) {
      return res;
    }
  }
  return null;
}

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

/**
 * Returns all known URLs which point to the specified resource.
 *
 * @param name
 *            the name of the requested resource.
 * @return the enumeration of URLs which point to the specified resource.
 * @throws IOException
 *             if an I/O error occurs while attempting to connect.
 */
@Override
public Enumeration<URL> findResources(final String name) throws IOException {
  if (name == null) {
    return null;
  }
  ArrayList<URL> result = new ArrayList<URL>();
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    handler.findResources(name, result);
  }
  return Collections.enumeration(result);
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Returns all known URLs which point to the specified resource.
 *
 * @param name
 *            the name of the requested resource.
 * @return the enumeration of URLs which point to the specified resource.
 * @throws IOException
 *             if an I/O error occurs while attempting to connect.
 */
@Override
public Enumeration<URL> findResources(final String name) throws IOException {
  if (name == null) {
    return null;
  }
  ArrayList<URL> result = new ArrayList<URL>();
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    handler.findResources(name, result);
  }
  return Collections.enumeration(result);
}

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

/**
 * Returns an URL referencing the specified resource or {@code null} if the
 * resource could not be found.
 *
 * @param name
 *            the name of the requested resource.
 * @return the URL which points to the given resource.
 */
@Override
public URL findResource(final String name) {
  if (name == null) {
    return null;
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    URL res = handler.findResource(name);
    if (res != null) {
      return res;
    }
  }
  return null;
}

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

/**
 * Returns an URL referencing the specified resource or {@code null} if the
 * resource could not be found.
 *
 * @param name
 *            the name of the requested resource.
 * @return the URL which points to the given resource.
 */
@Override
public URL findResource(final String name) {
  if (name == null) {
    return null;
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    URL res = handler.findResource(name);
    if (res != null) {
      return res;
    }
  }
  return null;
}

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

/**
 * Tries to locate and load the specified class using the known URLs. If the
 * class could be found, a class object representing the loaded class will
 * be returned.
 *
 * @throws ClassNotFoundException
 *             if the specified class cannot be loaded.
 */
@Override
protected Class<?> findClass(final String className) throws ClassNotFoundException {
  String partialName = className.replace('.', '/');
  final String classFileName = new StringBuilder(partialName).append(".class").toString();
  String packageName = null;
  int position = partialName.lastIndexOf('/');
  if ((position = partialName.lastIndexOf('/')) != -1) {
    packageName = partialName.substring(0, position);
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    Class<?> res = handler.findClass(packageName, classFileName, className);
    if (res != null) {
      return res;
    }
  }
  throw new ClassNotFoundException(className);
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Returns an URL referencing the specified resource or {@code null} if the
 * resource could not be found.
 *
 * @param name
 *            the name of the requested resource.
 * @return the URL which points to the given resource.
 */
@Override
public URL findResource(final String name) {
  if (name == null) {
    return null;
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    URL res = handler.findResource(name);
    if (res != null) {
      return res;
    }
  }
  return null;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Tries to locate and load the specified class using the known URLs. If the
 * class could be found, a class object representing the loaded class will
 * be returned.
 *
 * @throws ClassNotFoundException
 *             if the specified class cannot be loaded.
 */
@Override
protected Class<?> findClass(final String className) throws ClassNotFoundException {
  String partialName = className.replace('.', '/');
  final String classFileName = new StringBuilder(partialName).append(".class").toString();
  String packageName = null;
  int position = partialName.lastIndexOf('/');
  if ((position = partialName.lastIndexOf('/')) != -1) {
    packageName = partialName.substring(0, position);
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    Class<?> res = handler.findClass(packageName, classFileName, className);
    if (res != null) {
      return res;
    }
  }
  throw new ClassNotFoundException(className);
}

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

/**
 * Tries to locate and load the specified class using the known URLs. If the
 * class could be found, a class object representing the loaded class will
 * be returned.
 *
 * @throws ClassNotFoundException
 *             if the specified class cannot be loaded.
 */
@Override
protected Class<?> findClass(final String className) throws ClassNotFoundException {
  String partialName = className.replace('.', '/');
  final String classFileName = new StringBuilder(partialName).append(".class").toString();
  String packageName = null;
  int position = partialName.lastIndexOf('/');
  if ((position = partialName.lastIndexOf('/')) != -1) {
    packageName = partialName.substring(0, position);
  }
  int n = 0;
  while (true) {
    URLHandler handler = getHandler(n++);
    if (handler == null) {
      break;
    }
    Class<?> res = handler.findClass(packageName, classFileName, className);
    if (res != null) {
      return res;
    }
  }
  throw new ClassNotFoundException(className);
}

相关文章