/** This is a wrapper to <code>decode(final char[] code, final int from, final int len)</code> * @param code * @return a byte array holding encoded char data */ public final static byte[] decode(final char[] code) { return decode(code, 0, code.length); }
/** * This is a wrapper to <code>decode(final byte[] code, final int from, final int len)</code> * @param code * @return a byte array holding encoded char data */ public final static byte[] decode(final byte[] code) { return decode(code, 0, code.length); }
public Object convertString(String val, Object context) { return Base64.decode(val.getBytes()); } };
/** * Set the data. * @param data The data to set. */ public void setDataString(String sdata) { this.data = Base64.decode(sdata.getBytes(Charset.forName("UTF-8"))); }
default: return decode(code, from, cj - from);
public Object createObject(IContext context, Map rawattributes) throws Exception { byte[] bytes = Base64.decode(((String)rawattributes.get("content")).getBytes(Charset.forName("UTF-8"))); return Byte.valueOf(bytes[0]); } }),
public Object createObject(IContext context, Map rawattributes) throws Exception { String type = (String)rawattributes.get("type"); if(type==null) type = "X.509"; CertificateFactory cf = CertificateFactory.getInstance(type); return cf.generateCertificate(new ByteArrayInputStream(Base64.decode(((String)rawattributes.get("data")).getBytes()))); } }),
/** * Set the data. * * @param data The data to set. */ public void setDataString(String sdata) { this.data = ArrayTest.byteToshort(Base64.decode(sdata.getBytes())); }
public Object createObject(IContext context, Map rawattributes) throws Exception { Image ret = null; String encdata = (String) rawattributes.get("imgdata"); byte[] data = Base64.decode(encdata.getBytes()); String classname = (String) rawattributes.get("classname"); ret = SGUI.imageFromBytes(data, SReflect.findClass(classname, null, context.getClassLoader())); // if(classname.indexOf("Toolkit")!=-1) // { // Toolkit t = Toolkit.getDefaultToolkit(); // ret = t.createImage(data); // } // else // { // ret = ImageIO.read(new ByteArrayInputStream(data)); // } return ret; } }), new MappingInfo(null, new AttributeInfo[]
/** * Update from given properties. */ public IFuture<Void> setProperties(Properties props) { String tmp = props.getStringProperty("nickname"); if(tmp!=null) setNickName(tmp); tmp = props.getStringProperty("image"); if(tmp!=null) setImage(Base64.decode(tmp.getBytes(Charset.forName("UTF-8")))); called.setResultIfUndone(null); return IFuture.DONE; }
data2 = byteToshort(Base64.decode(str.getBytes())); time = System.nanoTime() - start; System.out.println("decoding base64 took "+(time/1000000)+" milliseconds");
byte[] enc = Base64.decode(encoded.getBytes());
/** * Update from given properties. */ public IFuture<Void> setProperties(Properties props) { String tmp = props.getStringProperty("nickname"); if(tmp!=null) setNickName(tmp); tmp = props.getStringProperty("image"); if(tmp!=null) setImage(Base64.decode(tmp.getBytes())); called.setResultIfUndone(null); return IFuture.DONE; }
/** * Update from given properties. */ public IFuture<Void> setProperties(Properties props) { String tmp = props.getStringProperty("nickname"); if(tmp!=null) setNickName(tmp); tmp = props.getStringProperty("image"); if(tmp!=null) { try { setImage(Base64.decode(tmp.getBytes("UTF-8"))); } catch(UnsupportedEncodingException e) { throw new RuntimeException(e); } } called.setResultIfUndone(null); return IFuture.DONE; }
/** * Process an object. * @param object The object. * @param targetcl If not null, the traverser should make sure that the result object is compatible with the class loader, * e.g. by cloning the object using the class loaded from the target class loader. * @return The processed object. */ public Object process(Object object, Type type, List<ITraverseProcessor> processors, Traverser traverser, Map<Object, Object> traversed, boolean clone, ClassLoader targetcl, Object context) { JsonObject obj = (JsonObject)object; Class<?> clazz = SReflect.getClass(type); String b64 = obj.getString("value", null); byte[] data = Base64.decode(b64.getBytes()); Image ret = ImageProcessor.imageFromBytes(data, clazz); // traversed.put(object, ret); // ((JsonReadContext)context).addKnownObject(ret); JsonValue idx = (JsonValue)obj.get(JsonTraverser.ID_MARKER); if(idx!=null) ((JsonReadContext)context).addKnownObject(ret, idx.asInt()); return ret; } }