summaryrefslogblamecommitdiffstats
path: root/src/main/java/com/kitfox/svg/xml/Base64Util.java
blob: a95b9d4fdf2876507a8419e9b147ece979d3d261 (plain) (tree)































                                                                                                                      
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kitfox.svg.xml;

/**
 *
 * @author kitfox
 */
public class Base64Util 
{
    static final byte[] valueToBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes();
    static final byte[] base64ToValue = new byte[128];
    static {
        for (int i = 0; i < valueToBase64.length; ++i)
        {
            base64ToValue[valueToBase64[i]] = (byte)i;
        }
    }
    
    static public byte encodeByte(int value)
    {
        return valueToBase64[value];
    }
    
    static public byte decodeByte(int base64Char)
    {
        return base64ToValue[base64Char];
    }
}