org.fusesource.hawtbuf.Buffer.split()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(88)

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

Buffer.split介绍

暂无

代码示例

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

@Override
public void processSaslStep(Sasl sasl) {
  byte[] data = new byte[sasl.pending()];
  sasl.recv(data, 0, data.length);
  Buffer[] parts = new Buffer(data).split((byte) 0);
  switch (parts.length) {
    case 0:
      // Treat this as anonymous connect to support legacy behavior
      // which allowed this.  Connection will fail if broker is not
      // configured to allow anonymous connections.
      break;
    case 2:
      username = parts[0].utf8().toString();
      password = parts[1].utf8().toString();
      break;
    case 3:
      username = parts[1].utf8().toString();
      password = parts[2].utf8().toString();
      break;
    default:
      setFailed("Invalid encoding of Authentication credentials");
      break;
  }
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

@Override
public void processSaslStep(Sasl sasl) {
  byte[] data = new byte[sasl.pending()];
  sasl.recv(data, 0, data.length);
  Buffer[] parts = new Buffer(data).split((byte) 0);
  switch (parts.length) {
    case 0:
      // Treat this as anonymous connect to support legacy behavior
      // which allowed this.  Connection will fail if broker is not
      // configured to allow anonymous connections.
      break;
    case 2:
      username = parts[0].utf8().toString();
      password = parts[1].utf8().toString();
      break;
    case 3:
      username = parts[1].utf8().toString();
      password = parts[2].utf8().toString();
      break;
    default:
      setFailed("Invalid encoding of Authentication credentials");
      break;
  }
}

相关文章