Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.util.Base64;

import java.io.UnsupportedEncodingException;

public class Main {
    public final static String ENCODING = "UTF-8";

    public static String encodedSafe(String data) throws UnsupportedEncodingException {
        //           byte[] b = Base64.encodeBase64(data.getBytes(ENCODING),true);
        byte[] b = Base64.encode(data.getBytes(ENCODING), Base64.URL_SAFE);
        return new String(b, ENCODING);
    }
}