com.monkeycoder.monkeynetwork
Class UpdateMessage

java.lang.Object
  extended by com.monkeycoder.monkeynetwork.UpdateMessage

public class UpdateMessage
extends java.lang.Object

Used within MonkeyNetwork as a unified update message.

Author:
David Stephens

Field Summary
static int UPDATE_CONTENT_DOWNLOAD_FAILED
          The requested content download has failed outright.
static int UPDATE_CONTENT_DOWNLOADED
          Content has completely and successfully downloaded.
static int UPDATE_INFO_ALT_CONTENT
          Informational, an error was detected and the content is likely an error page instead of the requested content.
static int UPDATE_INFO_REDIRECTING
          Informational, a 3xx level redirection is taking place.
static int UPDATE_NONE
          No Message
 
Constructor Summary
UpdateMessage(int inMessageType)
          Initializes a new UpdateMessage to a certain type.
UpdateMessage(int inMessageType, java.lang.Object inData)
          Initializes a new UpdateMessage to a certain type and bundles data with it.
UpdateMessage(int inMessageType, java.lang.String inData)
          Initializes a new UpdateMessage to a certain type and bundles String data with it.
 
Method Summary
 java.lang.Object getData()
          Returns the data of this message.
 java.lang.String getDataAsString()
          Returns the data of this message as a String.
 int getType()
          Returns the type of this message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UPDATE_NONE

public static final int UPDATE_NONE
No Message

See Also:
Constant Field Values

UPDATE_CONTENT_DOWNLOADED

public static final int UPDATE_CONTENT_DOWNLOADED
Content has completely and successfully downloaded. Additional informational messages that precede this message may adjust its meaning slightly.

See Also:
Constant Field Values

UPDATE_CONTENT_DOWNLOAD_FAILED

public static final int UPDATE_CONTENT_DOWNLOAD_FAILED
The requested content download has failed outright. This is a generic failure typically used for network errors.

See Also:
Constant Field Values

UPDATE_INFO_REDIRECTING

public static final int UPDATE_INFO_REDIRECTING
Informational, a 3xx level redirection is taking place. The host, port, and URI originally connected to should be requeried from the Network object.

See Also:
Constant Field Values

UPDATE_INFO_ALT_CONTENT

public static final int UPDATE_INFO_ALT_CONTENT
Informational, an error was detected and the content is likely an error page instead of the requested content. Content is not complete until UPDATE_CONTENT_DOWNLOADED is received.

See Also:
Constant Field Values
Constructor Detail

UpdateMessage

public UpdateMessage(int inMessageType)
Initializes a new UpdateMessage to a certain type. Used for types that don't have any data associated with them.

Parameters:
inMessageType - The type of the message.

UpdateMessage

public UpdateMessage(int inMessageType,
                     java.lang.Object inData)
Initializes a new UpdateMessage to a certain type and bundles data with it.

Parameters:
inMessageType - The type of the message.
inData - The data to bundle in with the message.

UpdateMessage

public UpdateMessage(int inMessageType,
                     java.lang.String inData)
Initializes a new UpdateMessage to a certain type and bundles String data with it.

Parameters:
inMessageType - The type of the message.
inData - The String data to bundle in with the message.
Method Detail

getType

public int getType()
Returns the type of this message.

Returns:
The type of this message.

getData

public java.lang.Object getData()
Returns the data of this message.

Returns:
The data of this message or null if there is no data.

getDataAsString

public java.lang.String getDataAsString()
Returns the data of this message as a String.

Returns:
The data of this message as a String or null if there is no data.