/** * @param text * @return encoded text */ public final static byte[] encode(final byte[] text) { return encode(text, 0, text.length); }
public String convertObject(Object val, Object context) { byte[] bytes = Base64.encode((byte[])val); return new String(bytes); } };
public String convertObject(Object val, Object context) { return new String(Base64.encode(new byte[]{((Byte)val).byteValue()})); } };
/** * Get the data as a transferable string. * @return the data string. */ public String getDataString() { String ret = null; if(data!=null) { ret = new String(Base64.encode(data), Charset.forName("UTF-8")); } return ret; }
public String convertObject(Object val, Object context) { try { byte[] buf = SGUI.imageToStandardBytes((Image) val, "image/png"); return new String(Base64.encode(buf)); } catch (Exception e) { // todo: use context report throw new RuntimeException(e); } } };
/** * Get the data as a transferable string. * * @return the data string. */ public String getDataString() { String ret = null; if(data!=null) { ret = new String(Base64.encode(ArrayTest.shortToByte(data))); } return ret; }
ret = new String(Base64.encode(baos.toByteArray()), "UTF-8");
/** * Write current state into properties. */ public IFuture<Properties> getProperties() { Properties props = new Properties(); // Only save as executing when in normal mode. props.addProperty(new Property("nickname", nick)); if(image!=null) props.addProperty(new Property("image", new String(Base64.encode(image), Charset.forName("UTF-8")))); return new Future<Properties>(props); } }
if(runs==0 && (time==0 || time==1)) System.out.println("digest ("+names[i]+"): "+new String(Base64.encode(output)));
str = new String(Base64.encode(shortToByte(data))); time = System.nanoTime() - start; System.out.println("encoding to base64 took "+(time/1000000)+" milliseconds");
/** * Write current state into properties. */ public IFuture<Properties> getProperties() { Properties props = new Properties(); // Only save as executing when in normal mode. props.addProperty(new Property("nickname", nick)); if(image!=null) props.addProperty(new Property("image", new String(Base64.encode(image)))); return new Future<Properties>(props); } }
/** * Write current state into properties. */ public IFuture<Properties> getProperties() { Properties props = new Properties(); // Only save as executing when in normal mode. props.addProperty(new Property("nickname", nick)); if(image!=null) { try { props.addProperty(new Property("image", new String(Base64.encode(image), "UTF-8"))); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } return new Future<Properties>(props); } }
hash = new String(Base64.encode(md.digest()), "UTF-8");
byte[] bytes = Base64.encode(ste.getEncoded()); String enc = new String(bytes);
/** * 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) { JsonWriteContext wr = (JsonWriteContext)context; wr.addObject(traversed, object); byte[] encimg = ImageProcessor.imageToStandardBytes((Image)object, "image/png"); byte[] bytes = Base64.encode(encimg); String enc = new String(bytes); wr.write("{"); wr.writeNameString("value", enc); if(wr.isWriteClass()) wr.write(",").writeClass(object.getClass()); if(wr.isWriteId()) wr.write(",").writeId(); wr.write("}"); return object; } }