Esempio n. 1
0
 public void readFrom(DataInput in) throws Exception {
   type = in.readByte();
   switch (type) {
     case DATA:
       seqno = Bits.readLong(in);
       conn_id = in.readShort();
       first = in.readBoolean();
       break;
     case ACK:
       seqno = Bits.readLong(in);
       conn_id = in.readShort();
       break;
     case SEND_FIRST_SEQNO:
       seqno = Bits.readLong(in);
       break;
   }
 }
Esempio n. 2
0
 public void writeTo(DataOutput out) throws Exception {
   out.writeByte(type);
   switch (type) {
     case DATA:
       Bits.writeLong(seqno, out);
       out.writeShort(conn_id);
       out.writeBoolean(first);
       break;
     case ACK:
       Bits.writeLong(seqno, out);
       out.writeShort(conn_id);
       break;
     case SEND_FIRST_SEQNO:
       Bits.writeLong(seqno, out);
       break;
   }
 }
Esempio n. 3
0
 public final int size() {
   int retval = Global.BYTE_SIZE; // type
   switch (type) {
     case DATA:
       retval +=
           Bits.size(seqno) // seqno
               + Global.SHORT_SIZE // conn_id
               + Global.BYTE_SIZE; // first
       break;
     case ACK:
       retval += Bits.size(seqno) + Global.SHORT_SIZE; // conn_id
       break;
     case SEND_FIRST_SEQNO:
       retval += Bits.size(seqno);
       break;
   }
   return retval;
 }
Esempio n. 4
0
 public int size() {
   return Global.BYTE_SIZE + Bits.size(seqno) + Global.BYTE_SIZE; // type + seqno + flush_ack
 }
Esempio n. 5
0
 public void readFrom(DataInput in) throws Exception {
   type = in.readByte();
   seqno = Bits.readLong(in);
   flush_ack = in.readBoolean();
 }
Esempio n. 6
0
 public void writeTo(DataOutput out) throws Exception {
   out.writeByte(type);
   Bits.writeLong(seqno, out);
   out.writeBoolean(flush_ack);
 }