de.enough.polish.android.messaging
Class BinaryMessageImpl

java.lang.Object
  extended by de.enough.polish.android.messaging.MessageImpl
      extended by de.enough.polish.android.messaging.BinaryMessageImpl
All Implemented Interfaces:
BinaryMessage, Message

public class BinaryMessageImpl
extends MessageImpl
implements BinaryMessage

Provides BinaryMessage functionalities.


Field Summary
 
Fields inherited from class de.enough.polish.android.messaging.MessageImpl
address, timestamp
 
Constructor Summary
BinaryMessageImpl(String address)
           
BinaryMessageImpl(String address, Date timestamp)
           
 
Method Summary
 byte[] getPayloadData()
          Returns the message payload data as an array of bytes.
 void setPayloadData(byte[] data)
          Sets the payload data of this message.
 
Methods inherited from class de.enough.polish.android.messaging.MessageImpl
getAddress, getTimestamp, setAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.enough.polish.android.messaging.Message
getAddress, getTimestamp, setAddress
 

Constructor Detail

BinaryMessageImpl

public BinaryMessageImpl(String address)

BinaryMessageImpl

public BinaryMessageImpl(String address,
                         Date timestamp)
Method Detail

getPayloadData

public byte[] getPayloadData()
Description copied from interface: BinaryMessage
Returns the message payload data as an array of bytes.

Returns null, if the payload for the message is not set.

The returned byte array is a reference to the byte array of this message and the same reference is returned for all calls to this method made before the next call to setPayloadData.

Specified by:
getPayloadData in interface BinaryMessage
Returns:
the payload data of this message or null if the data has not been set
See Also:
BinaryMessage.setPayloadData(byte[])

setPayloadData

public void setPayloadData(byte[] data)
Description copied from interface: BinaryMessage
Sets the payload data of this message. The payload may be set to null.

Setting the payload using this method only sets the reference to the byte array. Changes made to the contents of the byte array subsequently affect the contents of this BinaryMessage object. Therefore, applications should not reuse this byte array before the message is sent and the MessageConnection.send method returns.

Specified by:
setPayloadData in interface BinaryMessage
Parameters:
data - - payload data as a byte array
See Also:
BinaryMessage.getPayloadData()