## org.beepcore.beep.core
Class MessageImpl

    java.lang.Object
      org.beepcore.beep.core.MessageImpl

All Implemented Interfaces:
  Message

public class MessageImpl
extends java.lang.Object
implements Message

Message encapsulates the BEEP MSG, RPY, ERR and NUL message types.

Field Summary
`static int` `MESSAGE_TYPE_ANS` BEEP message type.
`static int` `MESSAGE_TYPE_ERR` BEEP message type.
`static int` `MESSAGE_TYPE_MSG` BEEP message type.
`static int` `MESSAGE_TYPE_NUL` BEEP message type.
`static int` `MESSAGE_TYPE_RPY` BEEP message type.
`static int` `MESSAGE_TYPE_UNK` Uninitialized BEEP message.

Method Summary
`int` `getAnsno()` Returns the answer number of this `Message`.
`Channel` `getChannel()` Returns the `Channel` to which this `Message` belongs.
`InputDataStream` `getDataStream()` Returns `InputDataStream` belonging to `Message`.
`int` `getMessageType()` Returns the message type of this `Message`.
`int` `getMsgno()` Returns the message number of this `Message`.
`MessageStatus` `sendANS(OutputDataStream stream)` Sends a message of type ANS.
`MessageStatus` `sendERR(BEEPError error)` Sends a message of type ERR.
`MessageStatus` `sendERR(int code, java.lang.String diagnostic)` Sends a message of type ERR.
`MessageStatus` `sendERR(int code, java.lang.String diagnostic, java.lang.String xmlLang)` Sends a message of type ERR.
`MessageStatus` `sendNUL()` Sends a message of type NUL.
`MessageStatus` `sendRPY(OutputDataStream stream)` Sends a message of type RPY.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MESSAGE_TYPE_UNK

    public static final int MESSAGE_TYPE_UNK

  Uninitialized BEEP message.

  See Also:
    Constant Field Values

### MESSAGE_TYPE_MSG

    public static final int MESSAGE_TYPE_MSG

  BEEP message type.

  See Also:
    Constant Field Values

### MESSAGE_TYPE_RPY

    public static final int MESSAGE_TYPE_RPY

  BEEP message type.

  See Also:
    Constant Field Values

### MESSAGE_TYPE_ERR

    public static final int MESSAGE_TYPE_ERR

  BEEP message type.

  See Also:
    Constant Field Values

### MESSAGE_TYPE_ANS

    public static final int MESSAGE_TYPE_ANS

  BEEP message type.

  See Also:
    Constant Field Values

### MESSAGE_TYPE_NUL

    public static final int MESSAGE_TYPE_NUL

  BEEP message type.

  See Also:
    Constant Field Values

Method Detail

### getDataStream

    public InputDataStream getDataStream()

  Returns `InputDataStream` belonging to `Message`.

  Specified by:
    `getDataStream` in interface `Message`
  See Also:
    `InputDataStream`

### getChannel

    public Channel getChannel()

  Returns the `Channel` to which this `Message` belongs.

  Specified by:
    `getChannel` in interface `Message`
  See Also:
    `Channel`

### getMsgno

    public int getMsgno()

  Returns the message number of this `Message`.

  Specified by:
    `getMsgno` in interface `Message`

### getAnsno

    public int getAnsno()

  Returns the answer number of this `Message`.

  Specified by:
    `getAnsno` in interface `Message`

### getMessageType

    public int getMessageType()

  Returns the message type of this `Message`.

  Specified by:
    `getMessageType` in interface `Message`

### sendANS

    public MessageStatus sendANS(OutputDataStream stream)
                          throws BEEPException

  Sends a message of type ANS.

  Specified by:
    `sendANS` in interface `Message`
  Parameters:
    `stream` - Data to send in the form of `OutputDataStream`.
  Returns:
    MessageStatus
  Throws:
    `BEEPException` - if an error is encoutered or if messageType is not MESSAGE_TYPE_MSG.
  See Also:
    `OutputDataStream`, `MessageStatus`, `sendNUL()`

### sendERR

    public MessageStatus sendERR(BEEPError error)
                          throws BEEPException

  Sends a message of type ERR.

  Specified by:
    `sendERR` in interface `Message`
  Parameters:
    `error` - Error to send in the form of `BEEPError`.
  Returns:
    MessageStatus
  Throws:
    `BEEPException` - if an error is encoutered or if messageType is not MESSAGE_TYPE_MSG.
  See Also:
    `BEEPError`, `MessageStatus`

### sendERR

    public MessageStatus sendERR(int code,
                                 java.lang.String diagnostic)
                          throws BEEPException

  Sends a message of type ERR.

  Specified by:
    `sendERR` in interface `Message`
  Parameters:
    `code` - `code` attibute in `error` element.
    `diagnostic` - Message for `error` element.
  Returns:
    MessageStatus
  Throws:
    `BEEPException` - if an error is encoutered or if messageType is not MESSAGE_TYPE_MSG.
  See Also:
    `MessageStatus`

### sendERR

    public MessageStatus sendERR(int code,
                                 java.lang.String diagnostic,
                                 java.lang.String xmlLang)
                          throws BEEPException

  Sends a message of type ERR.

  Specified by:
    `sendERR` in interface `Message`
  Parameters:
    `code` - `code` attibute in `error` element.
    `diagnostic` - Message for `error` element.
    `xmlLang` - `xml:lang` attibute in `error` element.
  Returns:
    MessageStatus
  Throws:
    `BEEPException` - if an error is encoutered or if messageType is not MESSAGE_TYPE_MSG.
  See Also:
    `MessageStatus`

### sendNUL

    public MessageStatus sendNUL()
                          throws BEEPException

  Sends a message of type NUL.

  Specified by:
    `sendNUL` in interface `Message`
  Returns:
    MessageStatus
  Throws:
    `BEEPException` - if an error is encoutered or if messageType is not MESSAGE_TYPE_MSG.
  See Also:
    `MessageStatus`, `sendANS(org.beepcore.beep.core.OutputDataStream)`

### sendRPY

    public MessageStatus sendRPY(OutputDataStream stream)
                          throws BEEPException

  Sends a message of type RPY.

  Specified by:
    `sendRPY` in interface `Message`
  Parameters:
    `stream` - Data to send in the form of `OutputDataStream`.
  Returns:
    MessageStatus
  Throws:
    `BEEPException` - if an error is encoutered or if messageType is not MESSAGE_TYPE_MSG.
  See Also:
    `OutputDataStream`, `MessageStatus`

Copyright ? 2001 Invisible Worlds, Inc. All Rights Reserved.