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

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

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

Strings.getBytesUtf8介绍

[英]Return UTF-8 encoded byte[] representation of a String
[中]返回字符串的UTF-8编码字节[]表示形式

代码示例

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

/**
 * Store the procedure's name
 * 
 * @param procedure The procedure's name
 */
public void setProcedure( String procedure )
{
  this.procedure = Strings.getBytesUtf8( procedure );
}

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

/**
 * Sets the credentials.
 *
 * @param credentials the credentials
 */
public void setCredentials( String credentials )
{
  this.credentials = Strings.getBytesUtf8( credentials );
}

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

/**
 * Sets the credentials.
 *
 * @param credentials the credentials
 */
public void setCredentials( String credentials )
{
  this.credentials = Strings.getBytesUtf8( credentials );
}

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

/**
 * Sets the credentials.
 *
 * @param credentials the credentials
 */
public void setCredentials( String credentials )
{
  this.credentials = Strings.getBytesUtf8( credentials );
}

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

/**
 * Store the procedure's name
 * 
 * @param procedure The procedure's name
 */
public void setProcedure( String procedure )
{
  this.procedure = Strings.getBytesUtf8( procedure );
}

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

/**
 * Store the procedure's name
 * 
 * @param procedure The procedure's name
 */
public void setProcedure( String procedure )
{
  this.procedure = Strings.getBytesUtf8( procedure );
}

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

/**
 * {@inheritDoc}
 */
@Override
public void dumpIndex( PartitionTxn partitionTxn, OutputStream stream, String name ) throws IOException
{
  stream.write( Strings.getBytesUtf8( "Nothing to dump for index " + name ) );
}

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

public byte[] getHistoryValue()
{
  StringBuilder sb = new StringBuilder();
  sb.append( time ).append( DELIMITER );
  sb.append( syntaxOID ).append( DELIMITER );
  sb.append( length ).append( DELIMITER );
  sb.append( data );
  return Strings.getBytesUtf8( sb.toString() );
}

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

/**
 * Base64 encode a String
 * 
 * @param str The string to encode
 * @return the base 64 encoded string
 */
private static String encodeBase64( String str )
{
  // force encoding using UTF-8 charset, as required in RFC2849 note 7
  return new String( Base64.encode( Strings.getBytesUtf8( str ) ) );
}

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

/**
 * {@inheritDoc}
 */
@Override
public BindRequest setCredentials( String credentials )
{
  return setCredentials( Strings.getBytesUtf8( credentials ) );
}

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

/**
 * {@inheritDoc}
 */
@Override
public BindRequest setCredentials( String credentials )
{
  return setCredentials( Strings.getBytesUtf8( credentials ) );
}

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

/**
 * @see #createStoragePassword(byte[], LdapSecurityConstants)
 * 
 * @param credentials The password
 * @param algorithm The algorithm to use
 * @return The resulting byte[] containing the paswword
 */
public static byte[] createStoragePassword( String credentials, LdapSecurityConstants algorithm )
{
  return createStoragePassword( Strings.getBytesUtf8( credentials ), algorithm );
}

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

/**
 * @see #createStoragePassword(byte[], LdapSecurityConstants)
 * 
 * @param credentials The password
 * @param algorithm The algorithm to use
 * @return The resulting byte[] containing the paswword
 */
public static byte[] createStoragePassword( String credentials, LdapSecurityConstants algorithm )
{
  return createStoragePassword( Strings.getBytesUtf8( credentials ), algorithm );
}

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

/**
 * @see #createStoragePassword(byte[], LdapSecurityConstants)
 * 
 * @param credentials The password
 * @param algorithm The algorithm to use
 * @return The resulting byte[] containing the paswword
 */
public static byte[] createStoragePassword( String credentials, LdapSecurityConstants algorithm )
{
  return createStoragePassword( Strings.getBytesUtf8( credentials ), algorithm );
}

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

/**
 * Base64 encode a String
 * 
 * @param str The string to encode
 * @return the base 64 encoded string
 */
private static String encodeBase64( String str )
{
  // force encoding using UTF-8 charset, as required in RFC2849 note 7
  return new String( Base64.encode( Strings.getBytesUtf8( str ) ) );
}

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

public static byte[] createCookie( int replicaId, String csn )
{
  // the syncrepl cookie format (compatible with OpenLDAP)
  // rid=nn,csn=xxxz
  String replicaIdStr = StringUtils.leftPad( Integer.toString( replicaId ), 3, '0' );
  return Strings.getBytesUtf8( REPLICA_ID_PREFIX + replicaIdStr + COOKIE_DELIM + CSN_PREFIX + csn );
}

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

/**
 * {@inheritDoc}
 */
@Override
public BindRequest setCredentials( String credentials )
{
  return setCredentials( Strings.getBytesUtf8( credentials ) );
}

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

/**
 * Base64 encode a String
 * 
 * @param str The string to encode
 * @return the base 64 encoded string
 */
private static String encodeBase64( String str )
{
  // force encoding using UTF-8 charset, as required in RFC2849 note 7
  return new String( Base64.encode( Strings.getBytesUtf8( str ) ) );
}

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

/**
 * {@inheritDoc}
 */
@Override
public void bind( Dn name, String credentials ) throws LdapException
{
  byte[] credBytes = credentials == null ? Strings.EMPTY_BYTES : Strings.getBytesUtf8( credentials );
  BindRequest bindRequest = new BindRequestImpl();
  bindRequest.setDn( name );
  bindRequest.setCredentials( credBytes );
  BindResponse bindResponse = bind( bindRequest );
  processResponse( bindResponse );
}

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

/**
 * Try to authenticate the usr against the underlying LDAP server.
 */
private CoreSession authenticate( String user, String password ) throws InvalidNameException, Exception
{
  BindOperationContext bindContext = new BindOperationContext( getLdapSession().getCoreSession() );
  bindContext.setDn( new Dn( user ) );
  bindContext.setCredentials( Strings.getBytesUtf8( password ) );
  getAdminSession().getDirectoryService().getOperationManager().bind( bindContext );
  return bindContext.getSession();
}

相关文章