1 package org.jgroups.protocols; 2 3 4 import org.jgroups.Header; 5 import org.jgroups.util.Streamable; 6 7 import java.io.*; 8 9 10 11 16 public class TpHeader extends Header implements Streamable { 17 public String channel_name=null; 18 int size=0; 19 20 public TpHeader() { 21 } 23 public TpHeader(String n) { 24 channel_name=n; 25 if(channel_name != null) 26 size=channel_name.length()+2; } 28 29 public String toString() { 30 return "[channel_name=" + channel_name + ']'; 31 } 32 33 34 public int size() { 35 return size; 36 } 37 38 public void writeExternal(ObjectOutput out) throws IOException { 39 out.writeUTF(channel_name); 40 } 41 42 43 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { 44 channel_name=in.readUTF(); 45 } 46 47 48 public void writeTo(DataOutputStream out) throws IOException { 49 out.writeUTF(channel_name); 50 } 51 52 public void readFrom(DataInputStream in) throws IOException, IllegalAccessException , InstantiationException { 53 channel_name=in.readUTF(); 54 if(channel_name != null) 55 size=channel_name.length()+2; } 57 } 58 | Popular Tags |