org.jgroups.util.Util.isFlagSet()方法的使用及代码示例

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

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

Util.isFlagSet介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

public boolean hasException() {
  return Util.isFlagSet(flags, IS_EXCEPTION);
}

代码示例来源:origin: wildfly/wildfly

public boolean isServer() {
  return Util.isFlagSet(flags, is_server) || Util.isFlagSet(flags, is_coord); // a coord is always a server
}

代码示例来源:origin: wildfly/wildfly

private String getType() {
    if(Util.isFlagSet(flags, FILE))
      return "file";
    if(Util.isFlagSet(flags, DIR))
      return "dir";
    return "n/a";
  }
}

代码示例来源:origin: wildfly/wildfly

public boolean isCoord() {
  return Util.isFlagSet(flags, is_coord);
}

代码示例来源:origin: wildfly/wildfly

public boolean isDirectory() {
  return Util.isFlagSet(flags, DIR);
}

代码示例来源:origin: wildfly/wildfly

public boolean wasSuspected() {
  return Util.isFlagSet(flags, SUSPECTED);
}

代码示例来源:origin: wildfly/wildfly

protected boolean received() {
  return Util.isFlagSet(flags, RECEIVED);
}

代码示例来源:origin: wildfly/wildfly

public boolean wasReceived() {
  return Util.isFlagSet(flags, RECEIVED);
}

代码示例来源:origin: wildfly/wildfly

public boolean wasUnreachable() {
  return Util.isFlagSet(flags, UNREACHABLE);
}

代码示例来源:origin: wildfly/wildfly

public boolean isFile() {
  return Util.isFlagSet(flags, FILE);
}

代码示例来源:origin: wildfly/wildfly

public boolean isDummy() {
  return Util.isFlagSet(flags, DUMMY);
}

代码示例来源:origin: wildfly/wildfly

public String toString() {
  boolean is_file=Util.isFlagSet(flags, FILE);
  StringBuilder sb=new StringBuilder();
  sb.append(getType());
  if(is_file)
    sb.append(", len=" + Util.printBytes(length) + ", chunk_size=" + chunk_size);
  sb.append(", mod_time=" + new Date(modification_time));
  return sb.toString();
}

代码示例来源:origin: wildfly/wildfly

public void readFrom(DataInput in) throws Exception {
  // 1. read the leading byte first
  byte leading=in.readByte();
  // 2. the flags
  flags=in.readShort();
  // 3. dest_addr
  if(Util.isFlagSet(leading, DEST_SET))
    dest_addr=Util.readAddress(in);
  // 4. src_addr
  if(Util.isFlagSet(leading, SRC_SET))
    src_addr=Util.readAddress(in);
  // 5. headers
  int len=in.readShort();
  this.headers=createHeaders(len);
  for(int i=0; i < len; i++) {
    short id=in.readShort();
    Header hdr=readHeader(in).setProtId(id);
    this.headers[i]=hdr;
  }
  // 6. buf
  if(Util.isFlagSet(leading, BUF_SET)) {
    len=in.readInt();
    buf=new byte[len];
    in.readFully(buf, 0, len);
    length=len;
  }
}

代码示例来源:origin: wildfly/wildfly

public static Address readAddress(DataInput in) throws Exception {
  byte flags=in.readByte();
  if(Util.isFlagSet(flags,Address.NULL))
    return null;
  Address addr;
  if(Util.isFlagSet(flags,Address.UUID_ADDR)) {
    addr=new UUID();
    addr.readFrom(in);
  }
  else if(Util.isFlagSet(flags,Address.SITE_UUID)) {
    addr=new SiteUUID();
    addr.readFrom(in);
  }
  else if(Util.isFlagSet(flags,Address.SITE_MASTER)) {
    addr=new SiteMaster();
    addr.readFrom(in);
  }
  else if(Util.isFlagSet(flags,Address.IP_ADDR)) {
    addr=new IpAddress();
    addr.readFrom(in);
  }
  else if(Util.isFlagSet(flags, Address.IP_ADDR_UUID)) {
    addr=new IpAddressUUID();
    addr.readFrom(in);
  }
  else {
    addr=readOtherAddress(in);
  }
  return addr;
}

代码示例来源:origin: wildfly/wildfly

/** Reads the message's contents from an input stream, but skips the buffer and instead returns the
 * position (offset) at which the buffer starts */
public int readFromSkipPayload(ByteArrayDataInputStream in) throws Exception {
  // 1. read the leading byte first
  byte leading=in.readByte();
  // 2. the flags
  flags=in.readShort();
  // 3. dest_addr
  if(Util.isFlagSet(leading, DEST_SET))
    dest_addr=Util.readAddress(in);
  // 4. src_addr
  if(Util.isFlagSet(leading, SRC_SET))
    src_addr=Util.readAddress(in);
  // 5. headers
  int len=in.readShort();
  headers=createHeaders(len);
  for(int i=0; i < len; i++) {
    short id=in.readShort();
    Header hdr=readHeader(in).setProtId(id);
    this.headers[i]=hdr;
  }
  // 6. buf
  if(!Util.isFlagSet(leading, BUF_SET))
    return -1;
  length=in.readInt();
  return in.position();
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

private String getType() {
    if(Util.isFlagSet(flags, FILE))
      return "file";
    if(Util.isFlagSet(flags, DIR))
      return "dir";
    return "n/a";
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public boolean isServer() {
  return Util.isFlagSet(flags, is_server) || Util.isFlagSet(flags, is_coord); // a coord is always a server
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public boolean wasReceived() {
  return Util.isFlagSet(flags, RECEIVED);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public boolean isCoord() {
  return Util.isFlagSet(flags, is_coord);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public String toString() {
  boolean is_file=Util.isFlagSet(flags, FILE);
  StringBuilder sb=new StringBuilder();
  sb.append(getType());
  if(is_file)
    sb.append(", len=" + Util.printBytes(length) + ", chunk_size=" + chunk_size);
  sb.append(", mod_time=" + new Date(modification_time));
  return sb.toString();
}

相关文章

Util类方法