com.sun.org.apache.xerces.internal.impl.dv.util.Base64.encode()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(119)

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

Base64.encode介绍

[英]Encodes hex octects into Base64
[中]将十六进制八位字节编码为Base64

代码示例

代码示例来源:origin: stackoverflow.com

import java.util.Random;

public class Base64Stuff
{
  public static void main(String[] args) {
    Random random = new Random();
    byte[] randomBytes = new byte[32];
    random.nextBytes(randomBytes);

    String internalVersion = com.sun.org.apache.xerces.internal.impl.dv.util.Base64.encode(randomBytes);
    byte[] apacheBytes =  org.apache.commons.codec.binary.Base64.encodeBase64(randomBytes);
    String fromApacheBytes = new String(apacheBytes);

    System.out.println("Internal length = " + internalVersion.length());
    System.out.println("Apache bytes len= " + fromApacheBytes.length());
    System.out.println("Internal version = |" + internalVersion + "|");
    System.out.println("Apache bytes     = |" + fromApacheBytes + "|");
    System.out.println("internal equal apache bytes?: " + internalVersion.equals(fromApacheBytes));
  }
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

public synchronized String toString() {
  if (canonical == null) {
    canonical = Base64.encode(data);
  }
  return canonical;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

public synchronized String toString() {
  if (canonical == null) {
    canonical = Base64.encode(data);
  }
  return canonical;
}

代码示例来源:origin: stackoverflow.com

ByteArrayOutputStream outputStreamForBarcode = new ByteArrayOutputStream();
   ImageIO.write(bufferedImage, "jpg", outputStreamForBarcode);
   String imageText = com.sun.org.apache.xerces.internal.impl.dv.util.Base64.encode(outputStreamForBarcode.toByteArray());

代码示例来源:origin: stackoverflow.com

return this.base64 = Base64.encode(this.flag);

代码示例来源:origin: org.hspconsortium/hsp-java-client

protected static void setAuthorizationHeader(HttpRequest request, String clientId, String clientSecret) {
  String authHeader = String.format("%s:%s", clientId, clientSecret);
  String encoded = Base64.encode(authHeader.getBytes());
  request.addHeader("Authorization", String.format("Basic %s", encoded));
}

代码示例来源:origin: XiaoMi/galaxy-sdk-java

/**
 * A handy version of {@link #sign(HttpMethod, java.net.URI, LinkedListMultimap,
 * String, SignAlgorithm)}, generates base64 encoded sign result.
 */
public static String signToBase64(HttpMethod httpMethod, URI uri,
  LinkedListMultimap<String, String> httpHeaders, String secretAccessKeyId,
  SignAlgorithm algorithm) throws NoSuchAlgorithmException,
  InvalidKeyException {
 return Base64.encode(sign(httpMethod, uri, httpHeaders, secretAccessKeyId,
   algorithm));
}

代码示例来源:origin: stackoverflow.com

package edu.sasik.test.encoding;

import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;

public class TestBase64 {

 public static void main(String[] args) {
  String base64Str = Base64.encode("Hello World!".getBytes());
  System.out.println(base64Str);
  byte[] bytes = Base64.decode(base64Str);
  System.out.println(new String(bytes));
 }

}

代码示例来源:origin: XiaoMi/galaxy-sdk-java

public void setContent(byte[] content) throws IOException {
 checkContentLength(content == null ? 0 : content.length);
 this.rawContent = content;
 this.content = Base64.encode(content);
}

代码示例来源:origin: org.hspconsortium.reference/hspc-reference-api-smart-support

protected static void setAuthorizationHeader(HttpRequest request, String clientId, String clientSecret) {
    String authHeader = String.format("%s:%s", clientId, clientSecret == null ? "" : clientSecret);
    String encoded = Base64.encode(authHeader.getBytes());
    request.addHeader("Authorization", String.format("Basic %s", encoded));
  }
}

代码示例来源:origin: com.xiaomi.infra.galaxy/galaxy-olap-sdk-java

/**
 * A handy version of {@link #sign(HttpMethod, java.net.URI, LinkedListMultimap,
 * String, SignAlgorithm)}, generates base64 encoded sign result.
 */
public static String signToBase64(String httpMethod, URI uri,
  LinkedListMultimap<String, String> httpHeaders, String secretAccessKeyId,
  String algorithm) throws NoSuchAlgorithmException,
  InvalidKeyException {
 return Base64.encode(sign(httpMethod, uri, httpHeaders, secretAccessKeyId,
   algorithm));
}

代码示例来源:origin: com.xiaomi.infra.galaxy/galaxy-client-java

/**
 * A handy version of {@link #sign(HttpMethod, java.net.URI, LinkedListMultimap,
 * String, SignAlgorithm)}, generates base64 encoded sign result.
 */
public static String signToBase64(HttpMethod httpMethod, URI uri,
  LinkedListMultimap<String, String> httpHeaders, String secretAccessKeyId,
  SignAlgorithm algorithm) throws NoSuchAlgorithmException,
  InvalidKeyException {
 return Base64.encode(sign(httpMethod, uri, httpHeaders, secretAccessKeyId,
   algorithm));
}

代码示例来源:origin: com.xiaomi.infra.galaxy/galaxy-fds-signer

/**
 * A handy version of {@link #sign(HttpMethod, URI, MultivaluedMap, String, SignAlgorithm)},
 * generates base64 encoded sign result.
 */
public static String signToBase64(HttpMethod httpMethod, URI uri,
  MultivaluedMap httpHeaders, String secretAccessKeyId,
  SignAlgorithm algorithm) throws NoSuchAlgorithmException,
  InvalidKeyException {
 return Base64.encode(sign(httpMethod, uri, httpHeaders, secretAccessKeyId,
   algorithm));
}

代码示例来源:origin: shawntime/shawn-common-utils

/**
 * 加密
 *
 * @param encryptString
 * @param encryptKey
 * @return
 * @throws Exception
 */
public static String encryptDES(String encryptString, String encryptKey)
    throws Exception {
  IvParameterSpec iv = new IvParameterSpec(iv1);
  DESKeySpec dks = new DESKeySpec(encryptKey.getBytes());
  SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
  SecretKey key = keyFactory.generateSecret(dks);
  Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
  cipher.init(Cipher.ENCRYPT_MODE, key, iv);
  return Base64.encode(cipher.doFinal(encryptString.getBytes()));
}

代码示例来源:origin: mil.army.missioncommand/mil-sym-renderer

if(width > 0 && height > 0)
  String b64 = "data:image/png;base64," + Base64.encode(getImageAsByteArray());

代码示例来源:origin: missioncommand/mil-sym-java

if(width > 0 && height > 0)
  String b64 = "data:image/png;base64," + Base64.encode(getImageAsByteArray());

代码示例来源:origin: stackoverflow.com

byte[] hash = f.generateSecret(spec).getEncoded();
String passHash = Base64.encode(hash);
String saltString = Base64.encode(salt);

代码示例来源:origin: stackoverflow.com

return (content.length == 0) ? null : Base64.encode(content);

代码示例来源:origin: com.hynnet/xws-security

throw new XWSSecurityException("No Matching public key for " + Base64.encode(keyIdentifier) + " subject key identifier found");

代码示例来源:origin: com.hynnet/xws-security

X509SubjectKeyIdentifier keyIdentifier = new X509SubjectKeyIdentifier(doc);
keyIdentifier.setCertificate(cert);
keyIdentifier.setReferenceValue(Base64.encode(skid));
SecurityTokenReference str = new SecurityTokenReference();
str.setReference(keyIdentifier);

相关文章

微信公众号

最新文章

更多