org.apache.directory.api.util.Strings.getString()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(69)

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

Strings.getString介绍

[英]From commons-httpclients. Converts the byte array of HTTP content characters to a string. If the specified charset is not supported, default system encoding is used.
[中]来自commons HttpClient。将HTTP内容字符的字节数组转换为字符串。如果不支持指定的字符集,则使用默认系统编码。

代码示例

代码示例来源:origin: org.apache.directory.api/api-all

/**
 * From commons-httpclients. Converts the byte array of HTTP content
 * characters to a string. If the specified charset is not supported,
 * default system encoding is used.
 *
 * @param data the byte array to be encoded
 * @param charset the desired character encoding
 * @return The result of the conversion.
 * @since 3.0
 */
public static String getString( final byte[] data, Charset charset )
{
  return getString( data, 0, data.length, charset );
}

代码示例来源:origin: org.apache.directory.api/api-all

/**
 * From commons-httpclients. Converts the byte array of HTTP content
 * characters to a string. If the specified charset is not supported,
 * default system encoding is used.
 *
 * @param data the byte array to be encoded
 * @param charset the desired character encoding
 * @return The result of the conversion.
 * @since 3.0
 */
public static String getString( final byte[] data, String charset )
{
  return getString( data, 0, data.length, charset );
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * From commons-httpclients. Converts the byte array of HTTP content
 * characters to a string. If the specified charset is not supported,
 * default system encoding is used.
 *
 * @param data the byte array to be encoded
 * @param charset the desired character encoding
 * @return The result of the conversion.
 * @since 3.0
 */
public static String getString( final byte[] data, String charset )
{
  return getString( data, 0, data.length, charset );
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * From commons-httpclients. Converts the byte array of HTTP content
 * characters to a string. If the specified charset is not supported,
 * default system encoding is used.
 *
 * @param data the byte array to be encoded
 * @param charset the desired character encoding
 * @return The result of the conversion.
 * @since 3.0
 */
public static String getString( final byte[] data, Charset charset )
{
  return getString( data, 0, data.length, charset );
}

代码示例来源:origin: org.apache.directory.api/api-ldap-model

/**
 * From commons-httpclients. Unescape and decode a given string regarded as
 * an escaped string with the default protocol charset.
 *
 * @param escaped a string
 * @return the unescaped string
 * @throws LdapUriException if the string cannot be decoded (invalid)
 */
private static String decode( String escaped ) throws LdapUriException
{
  try
  {
    byte[] rawdata = decodeUrl( getAsciiBytes( escaped ) );
    return Strings.getString( rawdata, StandardCharsets.UTF_8 );
  }
  catch ( UrlDecoderException e )
  {
    throw new LdapUriException( e.getMessage(), e );
  }
}

代码示例来源:origin: org.apache.directory.api/api-all

/**
 * From commons-httpclients. Unescape and decode a given string regarded as
 * an escaped string with the default protocol charset.
 *
 * @param escaped a string
 * @return the unescaped string
 * @throws LdapUriException if the string cannot be decoded (invalid)
 */
private static String decode( String escaped ) throws LdapUriException
{
  try
  {
    byte[] rawdata = decodeUrl( getAsciiBytes( escaped ) );
    return Strings.getString( rawdata, StandardCharsets.UTF_8 );
  }
  catch ( UrlDecoderException e )
  {
    throw new LdapUriException( e.getMessage(), e );
  }
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * From commons-httpclients. Unescape and decode a given string regarded as
 * an escaped string with the default protocol charset.
 *
 * @param escaped a string
 * @return the unescaped string
 * @throws LdapUriException if the string cannot be decoded (invalid)
 */
private static String decode( String escaped ) throws LdapUriException
{
  try
  {
    byte[] rawdata = decodeUrl( getAsciiBytes( escaped ) );
    return Strings.getString( rawdata, StandardCharsets.UTF_8 );
  }
  catch ( UrlDecoderException e )
  {
    throw new LdapUriException( e.getMessage(), e );
  }
}

相关文章