/** * Creates an {@link Icon Icon} with the specified image data. * * @param data * not-null image data bytes. * * @throws IllegalArgumentException * if the provided data is null * * @return An Icon instance representing the specified image data */ public static Icon from(byte[] data) { Checks.notNull(data, "Provided byte[]"); try { return new Icon(new String(Base64.getEncoder().encode(data), "UTF-8")); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); // thanks JDK 1.4 } } }