org.apache.felix.framework.util.Util.encode()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(94)

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

Util.encode介绍

[英]Encode a raw byte array to a Base64 String.
[中]将原始字节数组编码为Base64字符串。

代码示例

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

public static String base64Encode(String s) throws IOException
{
  return encode(s.getBytes(), 0);
}

代码示例来源:origin: apache/felix

public static String base64Encode(String s) throws IOException
{
  return encode(s.getBytes(), 0);
}

代码示例来源:origin: apache/felix

/**
 * Encode a raw byte array to a Base64 String.
 *
 * @param in Byte array to encode.
 * @param len Length of Base64 lines. 0 means no line breaks.
**/
public static String encode(byte[] in, int len) throws IOException
{
  ByteArrayOutputStream baos = null;
  ByteArrayInputStream bais = null;
  try
  {
    baos = new ByteArrayOutputStream();
    bais = new ByteArrayInputStream(in);
    encode(bais, baos, len);
    // ASCII byte array to String
    return (new String(baos.toByteArray()));
  }
  finally
  {
    if (baos != null)
    {
      baos.close();
    }
    if (bais != null)
    {
      bais.close();
    }
  }
}

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

/**
 * Encode a raw byte array to a Base64 String.
 *
 * @param in Byte array to encode.
 * @param len Length of Base64 lines. 0 means no line breaks.
**/
public static String encode(byte[] in, int len) throws IOException
{
  ByteArrayOutputStream baos = null;
  ByteArrayInputStream bais = null;
  try
  {
    baos = new ByteArrayOutputStream();
    bais = new ByteArrayInputStream(in);
    encode(bais, baos, len);
    // ASCII byte array to String
    return (new String(baos.toByteArray()));
  }
  finally
  {
    if (baos != null)
    {
      baos.close();
    }
    if (bais != null)
    {
      bais.close();
    }
  }
}

相关文章