com.google.api.client.util.Base64.encodeBase64URLSafeString()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中com.google.api.client.util.Base64.encodeBase64URLSafeString()方法的一些代码示例,展示了Base64.encodeBase64URLSafeString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Base64.encodeBase64URLSafeString()方法的具体详情如下:
包路径:com.google.api.client.util.Base64
类名称:Base64
方法名:encodeBase64URLSafeString

Base64.encodeBase64URLSafeString介绍

暂无

代码示例

代码示例来源:origin: magefree/mage

public static boolean sendMessage(String email, String subject, String text) {
    if (email.isEmpty()) {
      logger.info("Email is not sent because the address is empty");
      return false;
    }
    try {
      Gmail gmail = new Builder(httpTransport, JSON_FACTORY, credential).setApplicationName("XMage Server").build();

      MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));
      mimeMessage.addRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(email));
      mimeMessage.setSubject(subject);
      mimeMessage.setText(text);

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      mimeMessage.writeTo(baos);
      Message message = new Message();
      message.setRaw(Base64.encodeBase64URLSafeString(baos.toByteArray()));

      gmail.users().messages().send(ConfigSettings.instance.getGoogleAccount()
          + (ConfigSettings.instance.getGoogleAccount().endsWith("@gmail.com") ? "" : "@gmail.com"), message).execute();
      return true;
    } catch (MessagingException | IOException ex) {
      logger.error("Error sending message", ex);
    }
    return false;
  }
}

代码示例来源:origin: com.google.apis/google-api-services-books

/**
 * Base64 encoded data for this annotation data.
 * @see #setEncodedData()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public Annotationdata encodeEncodedData(byte[] encodedData) {
 this.encodedData = com.google.api.client.util.Base64.encodeBase64URLSafeString(encodedData);
 return this;
}

代码示例来源:origin: com.google.apis/google-api-services-mapsengine

/**
 * Next page token.
 * @see #setNextPageToken()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public PublishedMapsListResponse encodeNextPageToken(byte[] nextPageToken) {
 this.nextPageToken = com.google.api.client.util.Base64.encodeBase64URLSafeString(nextPageToken);
 return this;
}

代码示例来源:origin: com.google.apis/google-api-services-youtube

/**
 * @see #setImageBytes()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public InvideoBranding encodeImageBytes(byte[] imageBytes) {
 this.imageBytes = com.google.api.client.util.Base64.encodeBase64URLSafeString(imageBytes);
 return this;
}

代码示例来源:origin: org.ctoolkit.api/ctoolkit-agent-gen-lib

/**
 * @see #setData()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public ExportItem encodeData(byte[] data) {
 this.data = com.google.api.client.util.Base64.encodeBase64URLSafeString(data);
 return this;
}

代码示例来源:origin: org.ctoolkit.api/ctoolkit-agent-gen-lib

/**
 * @see #setData()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public ImportItem encodeData(byte[] data) {
 this.data = com.google.api.client.util.Base64.encodeBase64URLSafeString(data);
 return this;
}

代码示例来源:origin: com.google.apis/google-api-services-compute

/**
 * Fingerprint of the previous set of labels for this resource, used to prevent conflicts. Provide
 * the latest fingerprint value when making a request to add or change labels.
 * @see #setLabelFingerprint()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public InstancesSetLabelsRequest encodeLabelFingerprint(byte[] labelFingerprint) {
 this.labelFingerprint = com.google.api.client.util.Base64.encodeBase64URLSafeString(labelFingerprint);
 return this;
}

代码示例来源:origin: com.google.apis/google-api-services-gmail

/**
 * The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in
 * messages.get and drafts.get responses when the format=RAW parameter is supplied.
 * @see #setRaw()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public Message encodeRaw(byte[] raw) {
 this.raw = com.google.api.client.util.Base64.encodeBase64URLSafeString(raw);
 return this;
}

代码示例来源:origin: com.google.apis/google-api-services-cloudkms

/**
 * A message digest produced with the SHA-256 algorithm.
 * @see #setSha256()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public Digest encodeSha256(byte[] sha256) {
 this.sha256 = com.google.api.client.util.Base64.encodeBase64URLSafeString(sha256);
 return this;
}

代码示例来源:origin: com.google.apis/google-api-services-youtube

/**
 * @see #setMesh()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public LiveBroadcastContentDetails encodeMesh(byte[] mesh) {
 this.mesh = com.google.api.client.util.Base64.encodeBase64URLSafeString(mesh);
 return this;
}

代码示例来源:origin: com.google.apis/google-api-services-admin-directory

/**
 * Base64 encoded photo data
 * @see #setPhotoData()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public UserPhoto encodePhotoData(byte[] photoData) {
 this.photoData = com.google.api.client.util.Base64.encodeBase64URLSafeString(photoData);
 return this;
}

代码示例来源:origin: com.google.apis/google-api-services-iam

/**
 * The bytes to sign.
 * @see #setBytesToSign()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public SignBlobRequest encodeBytesToSign(byte[] bytesToSign) {
 this.bytesToSign = com.google.api.client.util.Base64.encodeBase64URLSafeString(bytesToSign);
 return this;
}

代码示例来源:origin: com.google.apis/google-api-services-iam

/**
 * The signed blob.
 * @see #setSignature()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public SignBlobResponse encodeSignature(byte[] signature) {
 this.signature = com.google.api.client.util.Base64.encodeBase64URLSafeString(signature);
 return this;
}

代码示例来源:origin: com.google.apis/google-api-services-cloudkms

/**
 * A message digest produced with the SHA-384 algorithm.
 * @see #setSha384()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public Digest encodeSha384(byte[] sha384) {
 this.sha384 = com.google.api.client.util.Base64.encodeBase64URLSafeString(sha384);
 return this;
}

代码示例来源:origin: org.ctoolkit.api/ctoolkit-agent-gen-lib

/**
 * @see #setData()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public MigrationItem encodeData(byte[] data) {
 this.data = com.google.api.client.util.Base64.encodeBase64URLSafeString(data);
 return this;
}

代码示例来源:origin: com.google.apis/google-api-services-mapsengine

/**
 * Next page token.
 * @see #setNextPageToken()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public RasterCollectionsListResponse encodeNextPageToken(byte[] nextPageToken) {
 this.nextPageToken = com.google.api.client.util.Base64.encodeBase64URLSafeString(nextPageToken);
 return this;
}

代码示例来源:origin: com.google.apis/google-api-services-ml

/**
 * HTTP body binary data.
 * @see #setData()
 *
 * <p>
 * The value is encoded Base64 or {@code null} for none.
 * </p>
 *
 * @since 1.14
 */
public GoogleApiHttpBody encodeData(byte[] data) {
 this.data = com.google.api.client.util.Base64.encodeBase64URLSafeString(data);
 return this;
}

代码示例来源:origin: objectify/objectify

return Base64.encodeBase64URLSafeString(keyMessageBuilder.build().toByteArray());

代码示例来源:origin: firebase/firebase-admin-java

private String signPayload(JsonWebSignature.Header header,
  FirebaseCustomAuthToken.Payload payload) throws IOException {
 String headerString = Base64.encodeBase64URLSafeString(jsonFactory.toByteArray(header));
 String payloadString = Base64.encodeBase64URLSafeString(jsonFactory.toByteArray(payload));
 String content = headerString + "." + payloadString;
 byte[] contentBytes = StringUtils.getBytesUtf8(content);
 String signature = Base64.encodeBase64URLSafeString(signer.sign(contentBytes));
 return content + "." + signature;
}

代码示例来源:origin: org.jbpm.contrib/google-mail-workitem

public static Message createMessageWithEmail(MimeMessage emailContent)
    throws MessagingException, IOException {
  ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  emailContent.writeTo(buffer);
  byte[] bytes = buffer.toByteArray();
  String encodedEmail = Base64.encodeBase64URLSafeString(bytes);
  Message message = new Message();
  message.setRaw(encodedEmail);
  return message;
}

相关文章