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

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

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

Message.readHeader介绍

暂无

代码示例

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

  1. public void readFrom(DataInput in) throws Exception {
  2. // 1. read the leading byte first
  3. byte leading=in.readByte();
  4. // 2. the flags
  5. flags=in.readShort();
  6. // 3. dest_addr
  7. if(Util.isFlagSet(leading, DEST_SET))
  8. dest_addr=Util.readAddress(in);
  9. // 4. src_addr
  10. if(Util.isFlagSet(leading, SRC_SET))
  11. src_addr=Util.readAddress(in);
  12. // 5. headers
  13. int len=in.readShort();
  14. this.headers=createHeaders(len);
  15. for(int i=0; i < len; i++) {
  16. short id=in.readShort();
  17. Header hdr=readHeader(in).setProtId(id);
  18. this.headers[i]=hdr;
  19. }
  20. // 6. buf
  21. if(Util.isFlagSet(leading, BUF_SET)) {
  22. len=in.readInt();
  23. buf=new byte[len];
  24. in.readFully(buf, 0, len);
  25. length=len;
  26. }
  27. }

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

  1. /** Reads the message's contents from an input stream, but skips the buffer and instead returns the
  2. * position (offset) at which the buffer starts */
  3. public int readFromSkipPayload(ByteArrayDataInputStream in) throws Exception {
  4. // 1. read the leading byte first
  5. byte leading=in.readByte();
  6. // 2. the flags
  7. flags=in.readShort();
  8. // 3. dest_addr
  9. if(Util.isFlagSet(leading, DEST_SET))
  10. dest_addr=Util.readAddress(in);
  11. // 4. src_addr
  12. if(Util.isFlagSet(leading, SRC_SET))
  13. src_addr=Util.readAddress(in);
  14. // 5. headers
  15. int len=in.readShort();
  16. headers=createHeaders(len);
  17. for(int i=0; i < len; i++) {
  18. short id=in.readShort();
  19. Header hdr=readHeader(in).setProtId(id);
  20. this.headers[i]=hdr;
  21. }
  22. // 6. buf
  23. if(!Util.isFlagSet(leading, BUF_SET))
  24. return -1;
  25. length=in.readInt();
  26. return in.position();
  27. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

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

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

  1. public void readFrom(DataInput in) throws Exception {
  2. // 1. read the leading byte first
  3. byte leading=in.readByte();
  4. // 2. the flags
  5. flags=in.readShort();
  6. // 3. dest_addr
  7. if(Util.isFlagSet(leading, DEST_SET))
  8. dest_addr=Util.readAddress(in);
  9. // 4. src_addr
  10. if(Util.isFlagSet(leading, SRC_SET))
  11. src_addr=Util.readAddress(in);
  12. // 5. headers
  13. int len=in.readShort();
  14. this.headers=createHeaders(len);
  15. for(int i=0; i < len; i++) {
  16. short id=in.readShort();
  17. Header hdr=readHeader(in).setProtId(id);
  18. this.headers[i]=hdr;
  19. }
  20. // 6. buf
  21. if(Util.isFlagSet(leading, BUF_SET)) {
  22. len=in.readInt();
  23. buf=new byte[len];
  24. in.readFully(buf, 0, len);
  25. length=len;
  26. }
  27. }

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

  1. /** Reads the message's contents from an input stream, but skips the buffer and instead returns the
  2. * position (offset) at which the buffer starts */
  3. public int readFromSkipPayload(ByteArrayDataInputStream in) throws Exception {
  4. // 1. read the leading byte first
  5. byte leading=in.readByte();
  6. // 2. the flags
  7. flags=in.readShort();
  8. // 3. dest_addr
  9. if(Util.isFlagSet(leading, DEST_SET))
  10. dest_addr=Util.readAddress(in);
  11. // 4. src_addr
  12. if(Util.isFlagSet(leading, SRC_SET))
  13. src_addr=Util.readAddress(in);
  14. // 5. headers
  15. int len=in.readShort();
  16. headers=createHeaders(len);
  17. for(int i=0; i < len; i++) {
  18. short id=in.readShort();
  19. Header hdr=readHeader(in).setProtId(id);
  20. this.headers[i]=hdr;
  21. }
  22. // 6. buf
  23. if(!Util.isFlagSet(leading, BUF_SET))
  24. return -1;
  25. length=in.readInt();
  26. return in.position();
  27. }

相关文章