src/net/java/sip/communicator/impl/protocol/jabber/ProtocolIconJabberImpl.java
/**
     * Loads an image from a given image path.
     * @param imagePath The identifier of the image.
     * @return The image for the given identifier.
     */
Loads an image from a given image path.
@param imagePath The identifier of the image.
@return The image for the given identifier.
Loads an image from a given image path . @param imagePath The identifier of the image . @return The image for the given identifier .
public static byte[] loadIcon(String imagePath) {
        InputStream is = null;
        try
        {
            is = new URL(imagePath).openStream();
        }
        catch (Exception e)
        {}
        if(is == null)
            is = getResources().getImageInputStreamForPath(imagePath);
        if(is == null)
                return new byte[0];
        byte[] icon = null;
        try {
            icon = new byte[is.available()];
            is.read(icon);
        } catch (IOException e) {
            logger.error("Failed to load icon: " + imagePath, e);
        }
        return icon;
    }
public static byte [ ] loadIcon ( String imagePath ) { InputStream is = null ; try { is = new URL ( imagePath ) . openStream ( ) ; } catch ( Exception e ) { } if ( is == null ) is = getResources ( ) . getImageInputStreamForPath ( imagePath ) ; if ( is == null ) return new byte [ 0 ] ; byte [ ] icon = null ; try { icon = new byte [ is . available ( ) ] ; is . read ( icon ) ; } catch ( IOException e ) { logger . error ( "Failed to load icon: " + imagePath , e ) ; } return icon ; }
Loads an image from a given image path.
Loads an image from a given image path .
// try to load path it maybe valid url