public static byte[] encode(byte[] data,int off,int length){
  int len=(length + 2) / 3 * 4;
  ByteArrayOutputStream bOut=new ByteArrayOutputStream(len);
  try {
    encoder.encode(data,off,length,bOut);
  }
 catch (  Exception e) {
    throw new EncoderException("exception encoding base64 string: " + e.getMessage(),e);
  }
  return bOut.toByteArray();
}

public static byte [ ] encode ( byte [ ] data , int off , int length ) { int len = ( length + 2 ) / 3 * 4 ; ByteArrayOutputStream bOut = new ByteArrayOutputStream ( len ) ; try { encoder . encode ( data , off , length , bOut ) ; } catch ( Exception e ) { throw new EncoderException ( "exception encoding base64 string: " + e . getMessage ( ) , e ) ; } return bOut . toByteArray ( ) ; }
encode the input data producing a base 64 encoded byte array .
