1 package org.jgroups.protocols; 2 3 import org.jgroups.Header; 4 import org.jgroups.auth.AuthToken; 5 import org.jgroups.util.Streamable; 6 import org.jgroups.util.Util; 7 8 import java.io.*; 9 13 public class AuthHeader extends Header implements Streamable{ 14 private AuthToken token=null; 15 16 public AuthHeader(){ 17 } 18 22 public void setToken(AuthToken token){ 23 this.token = token; 24 } 25 26 30 public AuthToken getToken(){ 31 return this.token; 32 } 33 34 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { 35 this.token = (AuthToken)in.readObject(); 36 } 37 38 public void writeExternal(ObjectOutput out) throws IOException { 39 out.writeObject(this.token); 40 } 41 42 public void writeTo(DataOutputStream out) throws IOException { 43 Util.writeAuthToken(this.token, out); 44 } 45 46 public void readFrom(DataInputStream in) throws IOException, IllegalAccessException , InstantiationException { 47 this.token = Util.readAuthToken(in); 48 } 49 public int size(){ 50 return Util.sizeOf(this); 52 } 53 } 54 55 | Popular Tags |