Package org.jgroups
Class FragmentedMessage
java.lang.Object
org.jgroups.BaseMessage
org.jgroups.BytesMessage
org.jgroups.FragmentedMessage
- All Implemented Interfaces:
Constructable<Message>,Message,SizeStreamable,Streamable
A message which refers to another message, but only marshals (
Streamable.writeTo(DataOutput))
a part of the original message, starting at a given BytesMessage.offset and marshalling only BytesMessage.length bytes.
The marshalling is done using PartialOutputStream.
Used by FRAG4.
- Since:
- 5.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jgroups.Message
Message.Flag, Message.TransientFlag -
Field Summary
FieldsFields inherited from class org.jgroups.BytesMessage
array, length, offsetFields inherited from class org.jgroups.BaseMessage
dest, DEST_SET, flags, headers, sender, SRC_SET, transient_flagsFields inherited from interface org.jgroups.Message
BYTES_MSG, COMPOSITE_MSG, EARLYBATCH_MSG, EMPTY_MSG, FRAG_MSG, LONG_MSG, NIO_MSG, OBJ_MSG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MessagecopyPayload(Message copy) Copies the byte array.create()Creates an instance of the class implementing this interfaceprotected <T extends BytesMessage>
TshortgetType()Returns the type of the message, e.g.booleanhasArray()Returns true if this message has a byte[] array as payload (even if it's null!), false otherwisebooleanReturns true if the message has a payload, e.g.voidreadPayload(DataInput in) protected inttoString()voidwritePayload(DataOutput out) Methods inherited from class org.jgroups.BytesMessage
getArray, getLength, getObject, getObject, getOffset, setArray, setArray, setFlag, setObject, sizeMethods inherited from class org.jgroups.BaseMessage
clearFlag, clearFlag, clearHeaders, copy, createHeaders, getDest, getFlags, getHeader, getHeaders, getNumHeaders, getPayload, getSrc, headers, headers, isFlagSet, isFlagSet, printHeaders, putHeader, putHeader, putHeaderIfAbsent, readFrom, serializedSize, setDest, setFlag, setFlag, setFlagIfAbsent, setPayload, setSrc, writeTo, writeToNoAddrs
-
Field Details
-
original_msg
-
-
Constructor Details
-
FragmentedMessage
public FragmentedMessage() -
FragmentedMessage
-
-
Method Details
-
getOriginalMessage
-
getType
public short getType()Description copied from interface:MessageReturns the type of the message, e.g. BYTES_MSG, OBJ_MSG etc- Specified by:
getTypein interfaceMessage- Overrides:
getTypein classBytesMessage
-
hasArray
public boolean hasArray()Description copied from interface:MessageReturns true if this message has a byte[] array as payload (even if it's null!), false otherwise- Specified by:
hasArrayin interfaceMessage- Overrides:
hasArrayin classBytesMessage
-
hasPayload
public boolean hasPayload()Description copied from interface:MessageReturns true if the message has a payload, e.g. a byte[] array in aBytesMessageor an object in anObjectMessage. This is more generic thanMessage.hasArray(), as it is not just applicable to a byte array.- Specified by:
hasPayloadin interfaceMessage- Overrides:
hasPayloadin classBytesMessage- Returns:
- True if the message has a payload
-
create
Description copied from interface:ConstructableCreates an instance of the class implementing this interface- Specified by:
createin interfaceConstructable<Message>- Overrides:
createin classBytesMessage
-
sizeOfPayload
protected int sizeOfPayload()- Overrides:
sizeOfPayloadin classBytesMessage
-
copyPayload
Description copied from class:BytesMessageCopies the byte array. If offset and length are used (to refer to another array), the copy will contain only the subset that offset and length point to, copying the subset into the new copy.Note that for headers, only the arrays holding references to the headers are copied, not the headers themselves ! The consequence is that the headers array of the copy hold the *same* references as the original, so do *not* modify the headers ! If you want to change a header, copy it and call
BaseMessage.putHeader(short,Header)again.- Overrides:
copyPayloadin classBytesMessage
-
writePayload
- Specified by:
writePayloadin interfaceMessage- Overrides:
writePayloadin classBytesMessage- Throws:
IOException
-
readPayload
- Specified by:
readPayloadin interfaceMessage- Overrides:
readPayloadin classBytesMessage- Throws:
IOException
-
toString
- Overrides:
toStringin classBaseMessage
-
createMessage
- Overrides:
createMessagein classBytesMessage
-