1 24 25 package org.objectweb.dream.pushwithreturn; 26 27 import java.io.Externalizable ; 28 import java.io.IOException ; 29 import java.io.ObjectInput ; 30 import java.io.ObjectOutput ; 31 32 import org.objectweb.dream.message.AbstractChunk; 33 import org.objectweb.dream.message.Chunk; 34 import org.objectweb.dream.message.ChunkType; 35 import org.objectweb.dream.util.Util; 36 37 40 public class KeyChunkImpl extends AbstractChunk 41 implements 42 KeyChunk, 43 Externalizable 44 { 45 Key key = null; 46 47 51 54 public Key getKey() 55 { 56 return key; 57 } 58 59 62 public void setKey(Key key) 63 { 64 this.key = key; 65 } 66 67 73 public ChunkType getType() 74 { 75 return TYPE; 76 } 77 78 81 public void transfertState(Chunk newInstance) 82 { 83 ((KeyChunk) newInstance).setKey(getKey()); 84 } 85 86 89 public void recycle() 90 { 91 key = null; 92 } 93 94 98 101 public void readExternal(ObjectInput in) throws IOException , 102 ClassNotFoundException 103 { 104 key = (Key) Util.readObject(in); 105 } 106 107 110 public void writeExternal(ObjectOutput out) throws IOException 111 { 112 Util.writeObject(out, key); 113 } 114 115 } | Popular Tags |