001 package railo.runtime.functions.conversion; 002 003 import railo.runtime.PageContext; 004 import railo.runtime.coder.Coder; 005 import railo.runtime.coder.CoderException; 006 import railo.runtime.exp.PageException; 007 import railo.runtime.ext.function.Function; 008 import railo.runtime.op.Caster; 009 010 /** 011 * Decodes Binary Data that are encoded as String 012 */ 013 public final class BinaryEncode implements Function { 014 015 /** 016 * @param pc 017 * @param binary 018 * @param binaryencoding 019 * @return encoded string 020 * @throws PageException 021 */ 022 public static String call(PageContext pc, byte[] binary, String binaryencoding) throws PageException { 023 try { 024 return Coder.encode(binaryencoding,binary); 025 } catch (CoderException e) { 026 throw Caster.toPageException(e); 027 } 028 } 029 }