001    /*
002     * To change this template, choose Tools | Templates
003     * and open the template in the editor.
004     */
005    
006    package com.kitfox.svg.xml;
007    
008    /**
009     *
010     * @author kitfox
011     */
012    public class Base64Util 
013    {
014        static final byte[] valueToBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes();
015        static final byte[] base64ToValue = new byte[128];
016        static {
017            for (int i = 0; i < valueToBase64.length; ++i)
018            {
019                base64ToValue[valueToBase64[i]] = (byte)i;
020            }
021        }
022        
023        static public byte encodeByte(int value)
024        {
025            return valueToBase64[value];
026        }
027        
028        static public byte decodeByte(int base64Char)
029        {
030            return base64ToValue[base64Char];
031        }
032    }