public static Byte[] decodeAsBoxed(final String data) { final byte[] primitiveArray = decode(data); final Byte[] boxedData = new Byte[primitiveArray.length]; for (int i = 0; i < primitiveArray.length; i++) { boxedData[i] = primitiveArray[i]; } return boxedData; }
value = (Y) Base64Util.decode(jsonValue.isString().stringValue());
public static Byte[] decodeAsBoxed(final String data) { final byte[] primitiveArray = decode(data); final Byte[] boxedData = new Byte[primitiveArray.length]; for (int i = 0; i < primitiveArray.length; i++) { boxedData[i] = primitiveArray[i]; } return boxedData; }
private static String getSVGContent(final String dataUriEncodedContent, final SVGGeneratorOptions options) { final SVGContentType type = getType(dataUriEncodedContent); String s = dataUriEncodedContent.substring(type.getLength()); if (SVGContentType.XML_BASE64.equals(type)) { s = new String(Base64Util.decode(s)); } if (options.removeXmlTag) { s = removeXmlTag(s); } if (options.removeUseTags) { s = removeAllUseTags(s); } else { s = removeUseTagsById(s, options.isRemoveUseForView); } if (options.removeHrefFileNames) { s = removeAllHrefFileName(s); } return s; }
@Override public T doNotNullDemarshall(final EJValue o, final MarshallingSession ctx) { final EJObject obj = o.isObject(); if (obj != null) { final String objId = obj.get(SerializationParts.OBJECT_ID).isString().stringValue(); if (ctx.hasObject(objId)) { // noinspection unchecked return (T) ctx.getObject(Object.class, objId); } EJValue val = obj.get(SerializationParts.QUALIFIED_VALUE); if (val.isNull()) { val = o; } return ctx.recordObject(objId, delegate.demarshall(val, ctx)); } else { // This is to support one-dimensional Jackson char and byte array representations which cannot be wrapped in // an JSON object by the transfomer because they are indistinguishable from plain Strings. Class<?> componentType = type.getComponentType(); if (o.isString() != null && componentType != null) { if (componentType.equals(byte.class)) { return (T) Base64Util.decode(o.isString().stringValue()); } else if (componentType.equals(char.class)) { return (T) o.isString().stringValue().toCharArray(); } } } return null; }
@Override public T doNotNullDemarshall(final EJValue o, final MarshallingSession ctx) { final EJObject obj = o.isObject(); if (obj != null) { final String objId = obj.get(SerializationParts.OBJECT_ID).isString().stringValue(); if (ctx.hasObject(objId)) { // noinspection unchecked return (T) ctx.getObject(Object.class, objId); } EJValue val = obj.get(SerializationParts.QUALIFIED_VALUE); if (val.isNull()) { val = o; } return ctx.recordObject(objId, delegate.demarshall(val, ctx)); } else { // This is to support one-dimensional Jackson char and byte array representations which cannot be wrapped in // an JSON object by the transfomer because they are indistinguishable from plain Strings. Class<?> componentType = type.getComponentType(); if (o.isString() != null && componentType != null) { if (componentType.equals(byte.class)) { return (T) Base64Util.decode(o.isString().stringValue()); } else if (componentType.equals(char.class)) { return (T) o.isString().stringValue().toCharArray(); } } } return null; }