1 18 package freecs.content; 19 20 import freecs.Server; 21 import freecs.interfaces.*; 22 import java.nio.ByteBuffer ; 23 24 public class PersonalizedMessage implements IContainer { 25 private ByteBuffer bBuff; 26 private boolean closeSocket = false; 27 28 public PersonalizedMessage (ByteBuffer bBuff, boolean closeSocket) { 29 this.bBuff = bBuff; 30 this.closeSocket = closeSocket; 31 if (Server.TRACE_CREATE_AND_FINALIZE) 32 Server.log (this, "++++++++++++++++++++++++++++++++++++++++CREATE", Server.MSG_STATE, Server.LVL_VERY_VERBOSE); 33 } 34 35 public PersonalizedMessage (ByteBuffer bBuff) { 36 this.bBuff = bBuff; 37 if (Server.TRACE_CREATE_AND_FINALIZE) 38 Server.log (this, "++++++++++++++++++++++++++++++++++++++++CREATE", Server.MSG_STATE, Server.LVL_VERY_VERBOSE); 39 } 40 41 public boolean prepareForSending () { return true; } 43 public ByteBuffer getByteBuffer () { 44 return bBuff; 45 } 46 47 public boolean hasContent () { 48 return (bBuff != null); 49 } 50 51 public boolean closeSocket () { 52 return closeSocket; 53 } 54 55 public void finalize() { 56 if (Server.TRACE_CREATE_AND_FINALIZE) 57 Server.log(this, "----------------------------------------FINALIZED", Server.MSG_STATE, Server.LVL_VERY_VERBOSE); 58 } 59 } | Popular Tags |