question: public static Credential decode ( Object encoded , Resource rolesDir ) throws PageException { String dec ; try { dec = Base64Coder . decodeToString ( Caster . toString ( encoded ) , "UTF-8" ) ; } catch ( Exception e ) { throw Caster . toPageException ( e ) ; } Array arr = ListUtil . listToArray ( dec , "" + ONE ) ; int len = arr . size ( ) ; if ( len == 3 ) { String str = Caster . toString ( arr . get ( 3 , "" ) ) ; if ( str . startsWith ( "md5:" ) ) { if ( ! rolesDir . exists ( ) ) rolesDir . mkdirs ( ) ; str = str . substring ( 4 ) ; Resource md5 = rolesDir . getRealResource ( str ) ; try { str = IOUtil . toString ( md5 , "utf-8" ) ; } catch ( IOException e ) { str = "" ; } } return new CredentialImpl ( Caster . toString ( arr . get ( 1 , "" ) ) , Caster . toString ( arr . get ( 2 , "" ) ) , str , rolesDir ) ; } if ( len == 2 ) return new CredentialImpl ( Caster . toString ( arr . get ( 1 , "" ) ) , Caster . toString ( arr . get ( 2 , "" ) ) , rolesDir ) ; if ( len == 1 ) return new CredentialImpl ( Caster . toString ( arr . get ( 1 , "" ) ) , rolesDir ) ; return null ; }
target:  decode the Credential form a Base64 String value