proper.remote.messages
Class DataMessage

java.lang.Object
  extended by proper.core.ProperObject
      extended by proper.remote.messages.Message
          extended by proper.remote.messages.DataMessage
All Implemented Interfaces:
ProperInterface
Direct Known Subclasses:
FileMessage

public class DataMessage
extends Message

This class encapsulates a DataMessage, where the data of the payload (file or something like this) is in the <body> tag of the Message.
The actual data looks like this:

    ...
    <body>
       <data>
          <line>...</line>
          ...
       </data>
    </body>
    ...
 

Version:
$Revision: 1.2 $
Author:
FracPete
See Also:
Message

Field Summary
static java.lang.String DATA
          the data tag
static java.lang.String LINE
          the status tag
 
Fields inherited from class proper.remote.messages.Message
BODY, FROM, HEADER, IP, MESSAGE, PORT, TYPE
 
Fields inherited from interface proper.core.ProperInterface
VERSION
 
Constructor Summary
DataMessage()
          initializes the object
DataMessage(Message msg)
          initializes the object with the given Message
DataMessage(java.io.Reader reader)
          initializes the object with the given xml data
 
Method Summary
 void clearBody()
          sets the body back to standard
 Element getData()
          returns the Data tag
 java.lang.String getLine(int index)
          returns the specified line
 int getLineCount()
          returns the number of stored lines
 java.util.Vector getLines()
          returns the lines of the data
 boolean isOtherMessage(Message msg)
          checks whether this message is of a different type, is used to determine whether the body has to be cleared if the data is copied from another Message
static void main(java.lang.String[] args)
          for testing only
 void setLines(java.io.Reader reader)
          sets the lines with the content of the given reader
 void setLines(java.lang.String filename)
          sets the lines with the content of the given file
 void setLines(java.util.Vector lines)
          sets the given lines in the message
 
Methods inherited from class proper.remote.messages.Message
clear, getBody, getBodyContent, getContent, getContent, getContent, getContent, getContent, getHeader, getIP, getPort, getType, setBodyContent, setContent, setIP, setPort, setType, toString
 
Methods inherited from class proper.core.ProperObject
addListener, addOutput, classInVerbose, debugprint, debugprint, debugprint, debugprint, debugprintln, debugprintln, debugprintln, debugprintln, debugprintln, getListeners, getRuntime, getVerbose, getVerboseLevel, getVerboseLevelForClass, getVerboseString, getVerboseStringForClass, notifyListener, notifyListeners, print, print, print, print, println, println, println, println, println, printMemory, removeListener, setOutput, setVerbose, setVerboseLevel, setVerboseString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATA

public static final java.lang.String DATA
the data tag

See Also:
Constant Field Values

LINE

public static final java.lang.String LINE
the status tag

See Also:
Constant Field Values
Constructor Detail

DataMessage

public DataMessage()
initializes the object


DataMessage

public DataMessage(java.io.Reader reader)
initializes the object with the given xml data


DataMessage

public DataMessage(Message msg)
initializes the object with the given Message

Method Detail

isOtherMessage

public boolean isOtherMessage(Message msg)
checks whether this message is of a different type, is used to determine whether the body has to be cleared if the data is copied from another Message

See Also:
DataMessage(Message), clearBody()

clearBody

public void clearBody()
sets the body back to standard

Overrides:
clearBody in class Message

getData

public Element getData()
returns the Data tag


getLines

public java.util.Vector getLines()
returns the lines of the data


getLineCount

public int getLineCount()
returns the number of stored lines


getLine

public java.lang.String getLine(int index)
returns the specified line


setLines

public void setLines(java.util.Vector lines)
sets the given lines in the message


setLines

public void setLines(java.lang.String filename)
sets the lines with the content of the given file


setLines

public void setLines(java.io.Reader reader)
sets the lines with the content of the given reader


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
for testing only

Throws:
java.lang.Exception