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

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

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

Strings.dumpHex介绍

[英]Helper function that returns a char from an hex
[中]从十六进制返回字符的Helper函数

代码示例

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

/**
 * Escape a binary value into a String form that is accepted as a Filter
 * 
 * @param bytes The data to escape
 * @return The escaped String
 */
private static String escapeBytes( byte[] bytes )
{
  // We have to escape all the bytes
  char[] chars = new char[bytes.length * 3];
  int pos = 0;
  
  for ( byte bb : bytes )
  {
    chars[pos++] = '\\';
    chars[pos++] = Strings.dumpHex( ( byte ) ( bb >> 4 ) );
    chars[pos++] = Strings.dumpHex( ( byte ) ( bb & 0x0F ) );
  }
  
  return new String( chars, 0, pos );
}

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

/**
 * Escape a binary value into a String form that is accepted as a Filter
 * 
 * @param bytes The data to escape
 * @return The escaped String
 */
private static String escapeBytes( byte[] bytes )
{
  // We have to escape all the bytes
  char[] chars = new char[bytes.length * 3];
  int pos = 0;
  
  for ( byte bb : bytes )
  {
    chars[pos++] = '\\';
    chars[pos++] = Strings.dumpHex( ( byte ) ( bb >> 4 ) );
    chars[pos++] = Strings.dumpHex( ( byte ) ( bb & 0x0F ) );
  }
  
  return new String( chars, 0, pos );
}

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

/**
 * Escape a binary value into a String form that is accepted as a Filter
 * 
 * @param bytes The data to escape
 * @return The escaped String
 */
private static String escapeBytes( byte[] bytes )
{
  // We have to escape all the bytes
  char[] chars = new char[bytes.length * 3];
  int pos = 0;
  
  for ( byte bb : bytes )
  {
    chars[pos++] = '\\';
    chars[pos++] = Strings.dumpHex( ( byte ) ( bb >> 4 ) );
    chars[pos++] = Strings.dumpHex( ( byte ) ( bb & 0x0F ) );
  }
  
  return new String( chars, 0, pos );
}

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

newChars[pos++] = '\\';
newChars[pos++] = '0';
newChars[pos++] = Strings.dumpHex( ( byte ) ( chars[i] & 0x0F ) );
break;
newChars[pos++] = '\\';
newChars[pos++] = '1';
newChars[pos++] = Strings.dumpHex( ( byte ) ( chars[i] & 0x0F ) );
break;

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

newChars[pos++] = '\\';
newChars[pos++] = '0';
newChars[pos++] = Strings.dumpHex( ( byte ) ( chars[i] & 0x0F ) );
break;
newChars[pos++] = '\\';
newChars[pos++] = '1';
newChars[pos++] = Strings.dumpHex( ( byte ) ( chars[i] & 0x0F ) );
break;

代码示例来源:origin: org.apache.directory.server/apacheds-ldif-partition

case ']': // 0x5D
case '|': // 0x7C
  sb.append( "%" ).append( Strings.dumpHex( ( byte ) ( c >> 4 ) ) )
    .append( Strings.dumpHex( ( byte ) ( c & 0xF ) ) );
  break;

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

newChars[pos++] = '\\';
newChars[pos++] = '0';
newChars[pos++] = Strings.dumpHex( ( byte ) ( chars[i] & 0x0F ) );
break;
newChars[pos++] = '\\';
newChars[pos++] = '1';
newChars[pos++] = Strings.dumpHex( ( byte ) ( chars[i] & 0x0F ) );
break;

相关文章