@Override public byte[] encode(byte[] toEncode, byte[] salt, byte[] passphrase, String charset) throws EncoderException { for (Encoder encoder : encoders) { toEncode = encoder.encode(toEncode, salt, passphrase, charset); } return toEncode; }
@Override public boolean isOfType(byte[] encodedBytes, String charset) { for (Encoder encoder : encoders) { if (!encoder.isOfType(encodedBytes, charset)) { return false; } } return true; }
@Override public byte[] decode(byte[] toDecode, byte[] passphrase, String charset) throws EncoderException { List<Encoder> reverse = new ArrayList<Encoder>(encoders); Collections.reverse(reverse); for (Encoder encoder : reverse) { toDecode = encoder.decode(toDecode, passphrase, charset); } return toDecode; }