org.codehaus.plexus.util.Base64.decodeBase64()方法的使用及代码示例

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

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

Base64.decodeBase64介绍

[英]Decodes Base64 data into octects
[中]将Base64数据解码为八位字节

代码示例

代码示例来源:origin: org.codehaus.plexus/plexus-utils

/**
 * Decodes a byte[] containing containing characters in the Base64 alphabet.
 *
 * @param pArray A byte array containing Base64 character data
 * @return a byte array containing binary data
 */
public byte[] decode( byte[] pArray )
{
  return decodeBase64( pArray );
}

代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core

/**
 * Decodes a byte[] containing containing
 * characters in the Base64 alphabet.
 *
 * @param pArray A byte array containing Base64 character data
 * @return a byte array containing binary data
 */
public byte[] decode(byte[] pArray) {
  return decodeBase64(pArray);
}

代码示例来源:origin: damianszczepanik/cucumber-reporting

public String getDecodedData() {
  return new String(Base64.decodeBase64(data.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
}

代码示例来源:origin: net.masterthought/cucumber-reporting

public String getDecodedData() {
  return new String(Base64.decodeBase64(data.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
}

代码示例来源:origin: trivago/cluecumber-report-plugin

public void encodeData(final String data) {
  if(mimeType.getContentType().equalsIgnoreCase("text/xml") || mimeType.getContentType().equalsIgnoreCase("application/xml")){
    String xmlString = new String(Base64.decodeBase64(data.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
    decodedData = xmlString.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
  }else{
    decodedData = new String(Base64.decodeBase64(data.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
  }
}

代码示例来源:origin: damianszczepanik/cucumber-reporting

private void storeEmbedding(Embedding embedding, File embeddingDirectory) {
  Path file = FileSystems.getDefault().getPath(embeddingDirectory.getAbsolutePath(),
      embedding.getFileId() + "." + embedding.getExtension());
  byte[] decodedData = Base64.decodeBase64(embedding.getData().getBytes(StandardCharsets.UTF_8));
  try {
    Files.write(file, decodedData);
  } catch (IOException e) {
    throw new ValidationException(e);
  }
}

代码示例来源:origin: net.masterthought/cucumber-reporting

private void storeEmbedding(Embedding embedding, File embeddingDirectory) {
  Path file = FileSystems.getDefault().getPath(embeddingDirectory.getAbsolutePath(),
      embedding.getFileId() + "." + embedding.getExtension());
  byte[] decodedData = Base64.decodeBase64(embedding.getData().getBytes(StandardCharsets.UTF_8));
  try {
    Files.write(file, decodedData);
  } catch (IOException e) {
    throw new ValidationException(e);
  }
}

代码示例来源:origin: org.apache.continuum/continuum-buildagent-webdav

String token = new String( Base64.decodeBase64( base64Token.getBytes() ) );

代码示例来源:origin: org.codehaus.redback/redback-xwork-integration

String token = new String( Base64.decodeBase64( base64Token.getBytes() ) );

代码示例来源:origin: org.kuali.common/kuali-util

@Override
public String decrypt(String text) {
  // Null not allowed
  checkNotNull(text, "text");
  // Decode the base64 text into bytes
  byte[] bytes = decodeBase64(getAsciiBytes(checkBase64(text)));
  // OpenSSL inserts the prefix "Salted__" followed by the salt itself
  int saltOffset = context.getSaltPrefix().length();
  byte[] salt = copyOfRange(bytes, saltOffset, saltOffset + context.getSaltSize());
  // encrypted bytes come after the prefix and the salt
  int encryptedBytesOffset = saltOffset + context.getSaltSize();
  // extract the portion of the array containing the encrypted bytes
  byte[] encrypted = copyOfRange(bytes, encryptedBytesOffset, bytes.length);
  // decrypt the bytes using the salt that was embedded in the text
  byte[] decrypted = doCipher(context, DECRYPT_MODE, salt, encrypted, password);
  // Construct a string from the decrypted bytes
  return getUTF8String(decrypted);
}

代码示例来源:origin: trivago/cluecumber-report-plugin

/**
 * Saves attachments to a file and returns the filename.
 *
 * @param embedding The {@link Embedding} to process.
 * @return The filename to the processed image.
 */
private String saveEmbeddingToFileAndGetFilename(final Embedding embedding) {        
  String fileEnding = "." + embedding.getFileEnding();
  byte[] dataBytes = Base64.decodeBase64(embedding.getData().getBytes(StandardCharsets.UTF_8));
  String filename = String.format("attachment%03d%s", attachmentIndex, fileEnding);
  try {
    fileIO.writeContentToFile(dataBytes, propertyManager.getGeneratedHtmlReportDirectory() + "/attachments/" + filename);
  } catch (FileCreationException e) {
    logger.error("Could not process image " + filename + " but will continue report generation...");
  }
  embedding.encodeData(embedding.getData());
  // Clear attachment data to reduce memory
  embedding.setData("");
  return filename;
}

代码示例来源:origin: org.codehaus.redback/redback-xwork-integration

String decodedNonce = new String( Base64.decodeBase64( nonce.getBytes() ) );
String nonceTokens[] = StringUtils.split( decodedNonce, ":" );

相关文章