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

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

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

Strings.dumpBytes介绍

[英]Helper function that dump an array of bytes in hex form
[中]Helper函数,以十六进制形式转储字节数组

代码示例

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

public void action( AdDirSyncContainer container )
  {
    BerValue value = container.getCurrentTLV().getValue();
    byte[] cookie = value.getData();
    if ( LOG.isDebugEnabled() )
    {
      LOG.debug( I18n.msg( I18n.MSG_08000_COOKIE, Strings.dumpBytes( cookie ) ) );
    }
    container.getAdDirSyncControl().setCookie( cookie );
    container.setGrammarEndAllowed( true );
  }
} );

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

/**
 * {@inheritDoc}
 */
@Override
public void encode( IoSession session, Object message, ProtocolEncoderOutput out ) throws Exception
{
  ByteBuffer buffer = encoder.encodeMessage( ( Message ) message );
  IoBuffer ioBuffer = IoBuffer.wrap( buffer );
  if ( CODEC_LOG.isDebugEnabled() )
  {
    byte[] dumpBuffer = new byte[buffer.limit()];
    buffer.get( dumpBuffer );
    buffer.flip();
    CODEC_LOG.debug( I18n.msg( I18n.MSG_14003_ENCODED_LDAP_MESSAGE, message, Strings.dumpBytes( dumpBuffer ) ) );
  }
  out.write( ioBuffer );
}

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

public void action( EndTransactionRequestContainer container ) throws DecoderException
  {
    BerValue value = container.getCurrentTLV().getValue();
    try
    {
      container.getEndTransactionRequest().setCommit( BooleanDecoder.parse( value ) );
    }
    catch ( BooleanDecoderException bde )
    {
      LOG.error( I18n
        .err( I18n.ERR_08221_BAD_END_TRANSACTION_COMMIT, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );
      // This will generate a PROTOCOL_ERROR
      throw new DecoderException( bde.getMessage(), bde );
    }
  }
} );

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

public void action( SyncDoneValueContainer container )
  {
    BerValue value = container.getCurrentTLV().getValue();
    byte[] cookie = value.getData();
    if ( LOG.isDebugEnabled() )
    {
      LOG.debug( I18n.msg( I18n.MSG_08000_COOKIE, Strings.dumpBytes( cookie ) ) );
    }
    container.getSyncDoneValueControl().setCookie( cookie );
    container.setGrammarEndAllowed( true );
  }
} );

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

/**
 * {@inheritDoc}
 */
@Override
public void encode( IoSession session, Object message, ProtocolEncoderOutput out ) throws Exception
{
  ByteBuffer buffer = encoder.encodeMessage( ( Message ) message );
  IoBuffer ioBuffer = IoBuffer.wrap( buffer );
  if ( CODEC_LOG.isDebugEnabled() )
  {
    byte[] dumpBuffer = new byte[buffer.limit()];
    buffer.get( dumpBuffer );
    buffer.flip();
    CODEC_LOG.debug( I18n.msg( I18n.MSG_14003_ENCODED_LDAP_MESSAGE, message, Strings.dumpBytes( dumpBuffer ) ) );
  }
  out.write( ioBuffer );
}

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

public void action( EndTransactionRequestContainer container ) throws DecoderException
  {
    BerValue value = container.getCurrentTLV().getValue();
    try
    {
      container.getEndTransactionRequest().setCommit( BooleanDecoder.parse( value ) );
    }
    catch ( BooleanDecoderException bde )
    {
      LOG.error( I18n
        .err( I18n.ERR_08221_BAD_END_TRANSACTION_COMMIT, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );
      // This will generate a PROTOCOL_ERROR
      throw new DecoderException( bde.getMessage(), bde );
    }
  }
} );

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

public void action( AdDirSyncContainer container )
  {
    BerValue value = container.getCurrentTLV().getValue();
    byte[] cookie = value.getData();
    if ( LOG.isDebugEnabled() )
    {
      LOG.debug( I18n.msg( I18n.MSG_08000_COOKIE, Strings.dumpBytes( cookie ) ) );
    }
    container.getAdDirSyncControl().setCookie( cookie );
    container.setGrammarEndAllowed( true );
  }
} );

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

/**
 * {@inheritDoc}
 */
@Override
public void encode( IoSession session, Object message, ProtocolEncoderOutput out ) throws Exception
{
  ByteBuffer buffer = encoder.encodeMessage( ( Message ) message );
  IoBuffer ioBuffer = IoBuffer.wrap( buffer );
  if ( CODEC_LOG.isDebugEnabled() )
  {
    byte[] dumpBuffer = new byte[buffer.limit()];
    buffer.get( dumpBuffer );
    buffer.flip();
    CODEC_LOG.debug( I18n.msg( I18n.MSG_14003_ENCODED_LDAP_MESSAGE, message, Strings.dumpBytes( dumpBuffer ) ) );
  }
  out.write( ioBuffer );
}

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

public void action( EndTransactionRequestContainer container ) throws DecoderException
  {
    BerValue value = container.getCurrentTLV().getValue();
    try
    {
      container.getEndTransactionRequest().setCommit( BooleanDecoder.parse( value ) );
    }
    catch ( BooleanDecoderException bde )
    {
      LOG.error( I18n
        .err( I18n.ERR_08221_BAD_END_TRANSACTION_COMMIT, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );
      // This will generate a PROTOCOL_ERROR
      throw new DecoderException( bde.getMessage(), bde );
    }
  }
} );

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

public void action( SyncRequestValueContainer container )
  {
    BerValue value = container.getCurrentTLV().getValue();
    byte[] cookie = value.getData();
    if ( LOG.isDebugEnabled() )
    {
      LOG.debug( I18n.msg( I18n.MSG_08000_COOKIE, Strings.dumpBytes( cookie ) ) );
    }
    container.getSyncRequestValueControl().setCookie( cookie );
    // We can have an END transition
    container.setGrammarEndAllowed( true );
  }
} );

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

public void action( EndTransactionResponseContainer container ) throws DecoderException
  {
    BerValue value = container.getCurrentTLV().getValue();
    try
    {
      int failedMessageId = IntegerDecoder.parse( value );
      
      if ( failedMessageId > 0 )
      {
        container.getEndTransactionResponse().setFailedMessageId( failedMessageId );
      }
      // We may have nothing left
      container.setGrammarEndAllowed( true );
    }
    catch ( IntegerDecoderException ide )
    {
      LOG.error( I18n
        .err( I18n.ERR_08221_BAD_END_TRANSACTION_COMMIT, Strings.dumpBytes( value.getData() ), ide.getMessage() ) );
      // This will generate a PROTOCOL_ERROR
      throw new DecoderException( ide.getMessage(), ide );
    }
  }
} );

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

public void action( SyncStateValueContainer container )
  {
    BerValue value = container.getCurrentTLV().getValue();
    byte[] entryUUID = value.getData();
    if ( LOG.isDebugEnabled() )
    {
      LOG.debug( I18n.msg( I18n.MSG_08106_ENTRY_UUID, Strings.dumpBytes( entryUUID ) ) );
    }
    container.getSyncStateValueControl().setEntryUUID( entryUUID );
    // We can have an END transition
    container.setGrammarEndAllowed( true );
  }
} );

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

public void action( SubentriesContainer container ) throws DecoderException
  {
    TLV tlv = container.getCurrentTLV();
    // We get the value. If it's a 0, it's a FALSE. If it's
    // a FF, it's a TRUE. Any other value should be an error,
    // but we could relax this constraint. So if we have
    // something
    // which is not 0, it will be interpreted as TRUE, but we
    // will generate a warning.
    BerValue value = tlv.getValue();
    try
    {
      container.getSubentriesControl().setVisibility( BooleanDecoder.parse( value ) );
      // We can have an END transition
      container.setGrammarEndAllowed( true );
    }
    catch ( BooleanDecoderException bde )
    {
      LOG.error( I18n.err( I18n.ERR_05310_INVALID_VISIBILITY_FLAG, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );
      // This will generate a PROTOCOL_ERROR
      throw new DecoderException( bde.getMessage() );
    }
  }
} );

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

public void action( SyncDoneValueContainer container )
  {
    BerValue value = container.getCurrentTLV().getValue();
    byte[] cookie = value.getData();
    if ( LOG.isDebugEnabled() )
    {
      LOG.debug( I18n.msg( I18n.MSG_08000_COOKIE, Strings.dumpBytes( cookie ) ) );
    }
    container.getSyncDoneValueControl().setCookie( cookie );
    container.setGrammarEndAllowed( true );
  }
} );

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

public void action( EndTransactionResponseContainer container ) throws DecoderException
  {
    BerValue value = container.getCurrentTLV().getValue();
    try
    {
      int failedMessageId = IntegerDecoder.parse( value );
      
      if ( failedMessageId > 0 )
      {
        container.getEndTransactionResponse().setFailedMessageId( failedMessageId );
      }
      // We may have nothing left
      container.setGrammarEndAllowed( true );
    }
    catch ( IntegerDecoderException ide )
    {
      LOG.error( I18n
        .err( I18n.ERR_08221_BAD_END_TRANSACTION_COMMIT, Strings.dumpBytes( value.getData() ), ide.getMessage() ) );
      // This will generate a PROTOCOL_ERROR
      throw new DecoderException( ide.getMessage(), ide );
    }
  }
} );

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

public void action( AdDirSyncContainer container )
  {
    BerValue value = container.getCurrentTLV().getValue();
    byte[] cookie = value.getData();
    if ( LOG.isDebugEnabled() )
    {
      LOG.debug( I18n.msg( I18n.MSG_08000_COOKIE, Strings.dumpBytes( cookie ) ) );
    }
    container.getAdDirSyncControl().setCookie( cookie );
    container.setGrammarEndAllowed( true );
  }
} );

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

public void action( EndTransactionResponseContainer container ) throws DecoderException
  {
    BerValue value = container.getCurrentTLV().getValue();
    try
    {
      int failedMessageId = IntegerDecoder.parse( value );
      
      if ( failedMessageId > 0 )
      {
        container.getEndTransactionResponse().setFailedMessageId( failedMessageId );
      }
      // We may have nothing left
      container.setGrammarEndAllowed( true );
    }
    catch ( IntegerDecoderException ide )
    {
      LOG.error( I18n
        .err( I18n.ERR_08221_BAD_END_TRANSACTION_COMMIT, Strings.dumpBytes( value.getData() ), ide.getMessage() ) );
      // This will generate a PROTOCOL_ERROR
      throw new DecoderException( ide.getMessage(), ide );
    }
  }
} );

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

public void action( SyncRequestValueContainer container )
  {
    BerValue value = container.getCurrentTLV().getValue();
    byte[] cookie = value.getData();
    if ( LOG.isDebugEnabled() )
    {
      LOG.debug( I18n.msg( I18n.MSG_08000_COOKIE, Strings.dumpBytes( cookie ) ) );
    }
    container.getSyncRequestValueControl().setCookie( cookie );
    // We can have an END transition
    container.setGrammarEndAllowed( true );
  }
} );

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

public void action( SubentriesContainer container ) throws DecoderException
  {
    TLV tlv = container.getCurrentTLV();
    // We get the value. If it's a 0, it's a FALSE. If it's
    // a FF, it's a TRUE. Any other value should be an error,
    // but we could relax this constraint. So if we have
    // something
    // which is not 0, it will be interpreted as TRUE, but we
    // will generate a warning.
    BerValue value = tlv.getValue();
    try
    {
      container.getSubentriesControl().setVisibility( BooleanDecoder.parse( value ) );
      // We can have an END transition
      container.setGrammarEndAllowed( true );
    }
    catch ( BooleanDecoderException bde )
    {
      LOG.error( I18n.err( I18n.ERR_05310_INVALID_VISIBILITY_FLAG, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );
      // This will generate a PROTOCOL_ERROR
      throw new DecoderException( bde.getMessage() );
    }
  }
} );

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

public void action( SyncRequestValueContainer container )
  {
    BerValue value = container.getCurrentTLV().getValue();
    byte[] cookie = value.getData();
    if ( LOG.isDebugEnabled() )
    {
      LOG.debug( I18n.msg( I18n.MSG_08000_COOKIE, Strings.dumpBytes( cookie ) ) );
    }
    container.getSyncRequestValueControl().setCookie( cookie );
    // We can have an END transition
    container.setGrammarEndAllowed( true );
  }
} );

相关文章