001 package railo.runtime.functions.string; 002 003 import railo.runtime.PageContext; 004 import railo.runtime.exp.PageException; 005 import railo.runtime.ext.function.Function; 006 import railo.runtime.op.Caster; 007 008 /** 009 * Implements the CFML Function tobase64 010 */ 011 public final class ToBase64 implements Function { 012 /** 013 * @param pc 014 * @param object 015 * @return base64 value as string 016 * @throws PageException 017 */ 018 public static String call(PageContext pc , Object object) throws PageException { 019 return call(pc,object,pc. getHttpServletResponse().getCharacterEncoding()); 020 } 021 /** 022 * @param pc 023 * @param object 024 * @param encoding 025 * @return base 64 value as string 026 * @throws PageException 027 */ 028 public static String call(PageContext pc , Object object, String encoding) throws PageException { 029 return Caster.toBase64(object,encoding); 030 } 031 }