* @param encoded output buffer
     * @since 2.3
     */
    public static void encode( java.nio.ByteBuffer raw, java.nio.CharBuffer encoded ){
        byte[] raw3 = new byte[3];
        byte[] enc4 = new byte[4];

        while( raw.hasRemaining() ){
            int rem = Math.min(3,raw.remaining());
            raw.get(raw3,0,rem);
            Base64.encode3to4(enc4, raw3, rem, Base64.NO_OPTIONS );
            for( int i = 0; i < 4; i++ ){
                encoded.put( (char)(enc4[i] & 0xFF) );
            }
        }   // end input remaining
    }