KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > net > protocol > GenericNetworkHeader


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.net.protocol;
5
6 public class GenericNetworkHeader extends AbstractTCNetworkHeader {
7
8   private static final int LENGTH = 12;
9
10   public GenericNetworkHeader() {
11     super(LENGTH, LENGTH);
12   }
13
14   public void setSequence(int sequence) {
15     data.putInt(4, sequence);
16   }
17
18   public int getSequence() {
19     return data.getInt(4);
20   }
21
22   public void setClientNum(int num) {
23     data.putInt(8, num);
24   }
25
26   public int getClientNum() {
27     return data.getInt(8);
28   }
29
30   public int getHeaderByteLength() {
31     return LENGTH;
32   }
33
34   protected void setHeaderLength(short length) {
35     if (length != LENGTH) { throw new IllegalArgumentException JavaDoc("Header length must be " + LENGTH); }
36
37     return;
38   }
39
40   public int getMessageDataLength() {
41     return data.getInt(0);
42   }
43
44   void setMessageDataLength(int length) {
45     data.putInt(0, length);
46   }
47
48   public void validate() {
49     return;
50   }
51
52 }
Popular Tags