public static byte[] encode(byte[] data){
  ByteArrayOutputStream bOut=new ByteArrayOutputStream();
  try {
    encoder.encode(data,0,data.length,bOut);
  }
 catch (  IOException e) {
    throw new RuntimeException("exception encoding base64 string: " + e);
  }
  return bOut.toByteArray();
}

public static byte [ ] encode ( byte [ ] data ) { ByteArrayOutputStream bOut = new ByteArrayOutputStream ( ) ; try { encoder . encode ( data , 0 , data . length , bOut ) ; } catch ( IOException e ) { throw new RuntimeException ( "exception encoding base64 string: " + e ) ; } return bOut . toByteArray ( ) ; }
encode the input data producing a base 64 encoded byte array .
