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

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

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

Base64.encodeBase64介绍

[英]Encodes binary data using the base64 algorithm but does not chunk the output.
[中]使用base64算法对二进制数据进行编码,但不分块输出。

代码示例

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

/**
 * Encodes a byte[] containing binary data, into a byte[] containing characters in the Base64 alphabet.
 *
 * @param pArray a byte array containing binary data
 * @return A byte array containing only Base64 character data
 */
public byte[] encode( byte[] pArray )
{
  return encodeBase64( pArray, false );
}

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

/**
 * Encodes binary data using the base64 algorithm but does not chunk the output.
 *
 * @param binaryData binary data to encode
 * @return Base64 characters
 */
public static byte[] encodeBase64( byte[] binaryData )
{
  return encodeBase64( binaryData, false );
}

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

/**
 * Encodes binary data using the base64 algorithm and chunks the encoded output into 76 character blocks
 *
 * @param binaryData binary data to encode
 * @return Base64 characters chunked in 76 character blocks
 */
public static byte[] encodeBase64Chunked( byte[] binaryData )
{
  return encodeBase64( binaryData, true );
}

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

/**
 * Encodes a byte[] containing binary data, into a byte[] containing
 * characters in the Base64 alphabet.
 *
 * @param pArray a byte array containing binary data
 * @return A byte array containing only Base64 character data
 */
public byte[] encode(byte[] pArray) {
  return encodeBase64(pArray, false);
}

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

/**
 * Encodes binary data using the base64 algorithm but
 * does not chunk the output.
 *
 * @param binaryData binary data to encode
 * @return Base64 characters
 */
public static byte[] encodeBase64(byte[] binaryData) {
  return encodeBase64(binaryData, false);
}

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

/**
 * Encodes binary data using the base64 algorithm and chunks
 * the encoded output into 76 character blocks
 *
 * @param binaryData binary data to encode
 * @return Base64 characters chunked in 76 character blocks
 */
public static byte[] encodeBase64Chunked(byte[] binaryData) {
  return encodeBase64(binaryData, true);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-maven-indexer

/**
 * @param s a string, such as a class name
 * @return the CRC-32 of its UTF-8 representation, as big-endian Base-64 without padding (so six chars), with _ for + (safer for Lucene)
 */
static String crc32base64(String s) {
  crc.reset();
  crc.update(s.getBytes(UTF8));
  long v = crc.getValue();
  byte[] b64 = Base64.encodeBase64(new byte[] {(byte) (v >> 24 & 0xFF), (byte) (v >> 16 & 0xFF), (byte) (v >> 8 & 0xFF), (byte) (v & 0xFF)});
  assert b64.length == 8;
  assert b64[6] == '=';
  assert b64[7] == '=';
  return new String(b64, 0, 6, LATIN1).replace('+', '_');
}
private static final CRC32 crc = new CRC32();

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

public void encrypt(InputStream in, OutputStream out) throws IOException {
  byte[] bytes = toByteArray(in);
  byte[] encrypted = encrypt(bytes);
  byte[] base64 = encodeBase64(encrypted, true);
  out.write(base64);
}

代码示例来源:origin: apache/maven-wagon

private void setAuthorization( HttpURLConnection urlConnection )
{
  if ( preemptiveAuthentication && authenticationInfo != null && authenticationInfo.getUserName() != null )
  {
    String credentials = authenticationInfo.getUserName() + ":" + authenticationInfo.getPassword();
    String encoded = new String( Base64.encodeBase64( credentials.getBytes() ) );
    urlConnection.setRequestProperty( "Authorization", "Basic " + encoded );
  }
}

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

authHeader.append( Base64.encodeBase64( rawnonce.getBytes() ) );
authHeader.append( "\"" );

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

@Override
public String encrypt(String text) {
  // Null not allowed
  checkNotNull(text, "text");
  // Convert the text into bytes
  byte[] bytes = getUTF8Bytes(text);
  // Encrypt the bytes
  byte[] encrypted = encrypt(bytes);
  // Encode as base 64
  byte[] base64 = encodeBase64(encrypted);
  // Convert the base64 bytes into a string
  return getAsciiString(base64);
}

代码示例来源:origin: mojohaus/license-maven-plugin

proxyLoginPasswordEncoded = new String( Base64.encodeBase64( loginPassword.getBytes() ) );

相关文章