public static RawType valueOf(String value) { int idx, idx2; if (value.isEmpty()) { throw new IllegalArgumentException("Argument must not be blank"); } else if (!value.startsWith("data:") || ((idx = value.indexOf(",")) < 0)) { throw new IllegalArgumentException("Invalid data URI syntax for argument " + value); } else if ((idx2 = value.indexOf(";")) <= 5) { throw new IllegalArgumentException("Missing MIME type in argument " + value); } return new RawType(Base64.getDecoder().decode(value.substring(idx + 1)), value.substring(5, idx2)); }
@Override public String format(String pattern) { return toFullString(); }
rawData = new RawType(data, contentType); LOGGER.debug("Media downloaded: size {} type {} (URL {})", rawData.getBytes().length, rawData.getMimeType(), url); } catch (IOException e) {
rawData = new RawType(data, contentType); logger.debug("Media download failed (URL {})", url); } else { logger.debug("Media downloaded: size {} type {} (URL {})", rawData.getBytes().length, rawData.getMimeType(), url);
public static RawType valueOf(String value) { int idx, idx2; if (value.isEmpty()) { throw new IllegalArgumentException("Argument must not be blank"); } else if (!value.startsWith("data:") || ((idx = value.indexOf(",")) < 0)) { throw new IllegalArgumentException("Invalid data URI syntax for argument " + value); } else if ((idx2 = value.indexOf(";")) <= 5) { throw new IllegalArgumentException("Missing MIME type in argument " + value); } return new RawType(Base64.getDecoder().decode(value.substring(idx + 1)), value.substring(5, idx2)); }
@Override public String format(String pattern) { return toFullString(); }