org.kaazing.gateway.util.Utils.asString()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(140)

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

Utils.asString介绍

暂无

代码示例

代码示例来源:origin: kaazing/gateway

@Override
public boolean matches(Object arg) {
  return (arg instanceof ByteBuffer) &&
      asString((ByteBuffer) arg).matches(pattern);
}

代码示例来源:origin: kaazing/gateway

@Deprecated // Use asString now it's been fixed to use UTF-8 CharSet
public static String asStringUTF8(ByteBuffer buf) {
  return asString(buf);
}

代码示例来源:origin: kaazing/gateway

@Override
public String toString() {
  return String.valueOf(getKind()) + ':' + ' ' +
      "status=" + status + ", reason=" + Utils.asString(reason);
}

代码示例来源:origin: kaazing/gateway

public static String asString(Map<ByteBuffer, ByteBuffer> headers) {
  if (headers == null) {
    return null;
  }
  Iterator<Entry<ByteBuffer, ByteBuffer>> i = headers.entrySet().iterator();
  if (! i.hasNext()) {
    return "{}";
  }
  StringBuilder sb = new StringBuilder();
  sb.append('{');
  for (;;) {
    Entry<ByteBuffer, ByteBuffer> e = i.next();
    ByteBuffer key = e.getKey();
    ByteBuffer value = e.getValue();
    sb.append(key   == headers ? "(this Map)" : asString(key));
    sb.append('=');
    sb.append(value == headers ? "(this Map)" : asString(value));
    if (! i.hasNext()) {
      return sb.append('}').toString();
    }
    sb.append(", ");
  }
}

相关文章