Android Open Source - TextEncoder Base64 Message






From Project

Back to project page TextEncoder.

License

The source code is released under:

Apache License

If you think the Android project TextEncoder listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.csab.TextEncoder;
/*from   ww  w  . j a  v  a  2  s.co m*/
import android.content.Context;
import android.util.Base64;
import org.apache.commons.codec.binary.StringUtils;

public class Base64Message extends Message {

    public Base64Message(byte[] inputArray) {
        setByteValuesArray(inputArray);
    }

    public Base64Message(String inputString, Context context) {
        setByteValuesArray(Base64.decode(inputString, Base64.DEFAULT));
    }

    public <T> T convert(Class<T> clazz) throws Exception {
        return clazz.getConstructor(byte[].class).newInstance(getByteValuesArray());
    }

    @Override
    public String toString() {
        return StringUtils.newStringUsAscii(Base64.encode(getByteValuesArray(), Base64.DEFAULT));
    }
}




Java Source Code List

com.csab.TextEncoder.AsciiMessage.java
com.csab.TextEncoder.Base64Message.java
com.csab.TextEncoder.BinaryMessage.java
com.csab.TextEncoder.Converter.java
com.csab.TextEncoder.DecimalMessage.java
com.csab.TextEncoder.HexMessage.java
com.csab.TextEncoder.MainActivity.java
com.csab.TextEncoder.Message.java
com.csab.TextEncoder.OctalMessage.java