Loads an image icon from a resource file.

@param iconName Name of the resource file to be loaded.
@param clazz    Class for which the resource exists.

@return Image icon if it could be loaded, null otherwise.
500674
public static ImageIcon loadImageIcon(final String iconName, final Class<?> clazz) {
        ImageIcon icon = null;

        if (iconName != null) {
            final URL iconResource = clazz.getResource(iconName);
            if (iconResource == null) {
                LOGGER.error("Icon could not be loaded: '" + iconName);
                icon = null;
            } else {
                icon = new ImageIcon(iconResource);
            }
        }

        return icon;
    }
794325
protected void processIcons(ArtifactMetadata amd, RepositoryResourceWritable res) throws RepositoryException {
        String current = "";
        String sizeString = "";
        String iconName = "";
        String iconNames = amd.getIcons();

        if (iconNames != null) {
            iconNames.replaceAll("\\s", "");

            StringTokenizer s = new StringTokenizer(iconNames, ",");
            while (s.hasMoreTokens()) {
                current = s.nextToken();
                int size = 0;

                if (current.contains(";")) { // if the icon has an associated
                                             // size
                    StringTokenizer t = new StringTokenizer(current, ";");
                    while (t.hasMoreTokens()) {
                        sizeString = t.nextToken();

                        if (sizeString.contains("size=")) {
                            String sizes[] = sizeString.split("size=");
                            size = Integer.parseInt(sizes[sizes.length - 1]);
                        } else {
                            iconName = sizeString;
                        }
                    }

                } else {
                    iconName = current;
                }

                File icon = this.extractFileFromArchive(amd.getArchive().getAbsolutePath(), iconName).getExtractedFile();

                if (icon.exists()) {
                    AttachmentResourceWritable at = res.addAttachment(icon, AttachmentType.THUMBNAIL);
                    if (size != 0) {
                        at.setImageDimensions(size, size);
                    }
                } else {
                    throw new RepositoryArchiveEntryNotFoundException("Icon does not exist", amd.getArchive(), iconName);
                }
            }
        }
    }
1346143
@NonNull
    public IconicsDrawable icon(@NonNull String icon) {
        try {
            ITypeface font = Iconics.findFont(mContext, icon.substring(0, 3));
            icon = icon.replace("-", "_");
            icon(font.getIcon(icon));
        } catch (Exception ex) {
            Log.e(Iconics.TAG, "Wrong icon name: " + icon);
        }
        return this;
    }
627249
public static Icon from(String name)
	{
		if (registeredIcons.get(name) != null)
			return registeredIcons.get(name);

		Icon icon = null;
		if (name.indexOf("minecraft:") == 0)
			icon = new VanillaIcon(name);
		else
			icon = new Icon(name);
		registeredIcons.put(name, icon);
		return icon;
	}
202271
public static String getResourceAsString(Class<?> clazz, String resource) throws IOException {
        try (InputStream inputStream = clazz.getResourceAsStream(resource)) {
            return IoUtils.toString(inputStream);
        }
    }
87579
public ServerBuilder setIcon(InputStream icon, String fileType) {
        delegate.setIcon(icon, fileType);
        return this;
    }
771194
public static function appIcons() {
    $config = Config::instance();
    $icons_directory = THEME_DIRECTORY.'/'.$config->app_icons_directory;
    $icons_url = THEME_URL.'/'.$config->app_icons_directory;
    if(!file_exists($icons_directory)) return null;
    
    $files = scandir($icons_directory);
    if(!Arr::iterable($files)) return null;
    
    // Icon files should start with one of these, and be delimited by hyphens
    $icon_types = ['apple', 'android', 'favicon'];
    $paths = [];
    
    foreach($files as $file)  {
      if(!preg_match('/\.png$/', $file)) continue;
      
      // Get size from image name
      preg_match('/(\d+x\d+)/', $file, $sizes);
      if(!Arr::iterable($sizes)) continue;
      
      $size = reset($sizes);
      $icon_type = reset(explode('-', $file));
      if(!in_array($icon_type, $icon_types)) continue;
      
      $file_path = $icons_url.'/'.$file;
      $paths[] = View::make('meta/icon-'.$icon_type, [
        'file' => $file_path,
        'size' => $size,
      ]);
    }
    
    $paths[] = View::make('meta/icon-favicon-ico', [
      'file' => $icons_url.'/favicon.ico',
    ]);
    return join('', $paths);
  }
1076262
public ImageIcon getCacheValue(Object objKey)
    {
        if (m_hmCache == null)
            return null;
        if (objKey == null)
            return null;
        Class<?> classKey = this.getField().getDataClass();
        objKey = this.convertKey(objKey, classKey);
        return (ImageIcon)m_hmCache.get(objKey);
    }
296960
public static String readResource(Class<?> clazz, String path)
    {
        File targetFile = resolve(clazz, path);
        if (targetFile == null)
        {
            return null;
        }

        String result;

        try
        {
            result = FileUtils.readFileToString(targetFile, "UTF-8");
        }
        catch (IOException ex)
        {
            return null;
        }

        return result;
    }
395806
function (name) {
		// @option imagePath: String
		// `Icon.Default` will try to auto-detect the location of
		// the blue icon images. If you are placing these images in a
		// non-standard way, set this option to point to the right
		// path, before any marker is added to a map.
		// Caution: do not use this option with inline base64 image(s).
		var imagePath = this.options.imagePath || L.Icon.Default.imagePath || '';
		// Deprecated (IconDefault.imagePath), backwards-compatibility only

		if (this._needsInit) {
			// Modifying imagePath option after _getIconUrl has been called
			// once in this instance of IconDefault will no longer have any
			// effect.
			this._initializeOptions(imagePath);
		}

		return imagePath + L.Icon.prototype._getIconUrl.call(this, name);
	}
644002
public static Icon getImageIcon(ClassLoader objectLoader, String fileName) throws UrlProviderException
	{
		return getImageIcon(new ClassLoaderUrlProvider(objectLoader), fileName);
	}
19573
protected Class<?> loadClass(String clazz) throws ClassNotFoundException {
		if (this.classLoader == null){
			return Class.forName(clazz);
		}

		return Class.forName(clazz, true, this.classLoader);

	}
833629
@Nullable
  public static File findFile(@Nullable final Class<?> clazz) {
    if (null == clazz) return null;
    String name = clazz.getName();
    if (null == name) return null;
    final String path = name.replaceAll("\\.", "/").replaceAll("\\$.*", "");
    return com.simiacryptus.util.lang.CodeUtil.findFile(path + ".java");
  }
916576
public static Image getImageFromResources(Class<?> clazz, String name, Toolkit toolkit) throws IOException {
		byte[] imageData;
		InputStream in = clazz.getResourceAsStream(name);
		if(in==null) throw new IOException("Unable to find resource: "+name);
		try {
			imageData = IoUtils.readFully(in);
		} finally {
			in.close();
		}
		return toolkit.createImage(imageData);
	}
714693
public void setIcon(String icon) {

        m_icon = icon;
        if (LOG.isDebugEnabled()) {
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_ICON_1, icon));
        }
    }
514532
public static Properties loadProperties(final Class<?> clasz, final String filename) {
        checkNotNull("clasz", clasz);
        checkNotNull("filename", filename);

        final String path = getPackagePath(clasz);
        final String resPath = path + "/" + filename;
        return loadProperties(clasz.getClassLoader(), resPath);

    }
81621
public Object getIcon(int iIconType)
    {
        if (m_iIconField == -1)
            return null;
        Object data = this.getFieldData(m_iIconField);
        if (data instanceof PortableImage)
            return ((PortableImage)data).getImage();     // Make sure you cache this
        else //if (data instanceof ImageIcon)
            return this.getFieldData(m_iIconField);
        //else
        //    return null;
    }