org.jgroups.Message.readHeader()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(150)

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

Message.readHeader介绍

暂无

代码示例

代码示例来源: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

/** 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.jgroups/com.springsource.org.jgroups

for(int i=0; i < len; i++) {
  hdr_name=in.readUTF();
  hdr=readHeader(in);
  headers.put(hdr_name, hdr);

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

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: org.jboss.eap/wildfly-client-all

/** 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();
}

相关文章