1 20 package org.apache.mina.common.support; 21 22 import org.apache.mina.common.IoSession; 23 import org.apache.mina.common.WriteFuture; 24 25 31 public class DefaultWriteFuture extends DefaultIoFuture implements WriteFuture { 32 35 public static WriteFuture newWrittenFuture(IoSession session) { 36 DefaultWriteFuture unwrittenFuture = new DefaultWriteFuture(session); 37 unwrittenFuture.setWritten(true); 38 return unwrittenFuture; 39 } 40 41 44 public static WriteFuture newNotWrittenFuture(IoSession session) { 45 DefaultWriteFuture unwrittenFuture = new DefaultWriteFuture(session); 46 unwrittenFuture.setWritten(false); 47 return unwrittenFuture; 48 } 49 50 53 public DefaultWriteFuture(IoSession session) { 54 super(session); 55 } 56 57 public boolean isWritten() { 58 if (isReady()) { 59 return (Boolean ) getValue(); 60 } else { 61 return false; 62 } 63 } 64 65 public void setWritten(boolean written) { 66 setValue(written ? Boolean.TRUE : Boolean.FALSE); 67 } 68 } 69 | Popular Tags |