Package org.apache.mina.core.write
Class DefaultWriteRequest
java.lang.Object
org.apache.mina.core.write.DefaultWriteRequest
- All Implemented Interfaces:
WriteRequest
- Direct Known Subclasses:
ProtocolCodecFilter.EncodedWriteRequest
The default implementation of
WriteRequest.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SocketAddressstatic final byte[]An empty messageprivate final WriteFutureprivate final Objectprivate static final WriteFutureAn empty FUTURE -
Constructor Summary
ConstructorsConstructorDescriptionDefaultWriteRequest(Object message) Creates a new instance withoutWriteFuture.DefaultWriteRequest(Object message, WriteFuture future) Creates a new instance withWriteFuture.DefaultWriteRequest(Object message, WriteFuture future, SocketAddress destination) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the destination of this write request.booleanTells if the current message has been encodedtoString()
-
Field Details
-
EMPTY_MESSAGE
public static final byte[] EMPTY_MESSAGEAn empty message -
UNUSED_FUTURE
An empty FUTURE -
message
-
future
-
destination
-
-
Constructor Details
-
DefaultWriteRequest
Creates a new instance withoutWriteFuture. You'll get an instance ofWriteFutureeven if you called this constructor becausegetFuture()will return a bogus future.- Parameters:
message- The message that will be written
-
DefaultWriteRequest
Creates a new instance withWriteFuture.- Parameters:
message- The message that will be writtenfuture- The associatedWriteFuture
-
DefaultWriteRequest
Creates a new instance.- Parameters:
message- a message to writefuture- a future that needs to be notified when an operation is finisheddestination- the destination of the message. This property will be ignored unless the transport supports it.
-
-
Method Details
-
getFuture
- Specified by:
getFuturein interfaceWriteRequest- Returns:
WriteFuturethat is associated with this write request.
-
getMessage
- Specified by:
getMessagein interfaceWriteRequest- Returns:
- a message object to be written.
-
getOriginalRequest
- Specified by:
getOriginalRequestin interfaceWriteRequest- Returns:
- the
WriteRequestwhich was requested originally, which is not transformed by anyIoFilter.
-
getDestination
Returns the destination of this write request.- Specified by:
getDestinationin interfaceWriteRequest- Returns:
nullfor the default destination
-
toString
-
isEncoded
public boolean isEncoded()Tells if the current message has been encoded- Specified by:
isEncodedin interfaceWriteRequest- Returns:
- true if the message has already been encoded
-