Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Cryptix OpenPGP
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cryptix.message
Class LiteralMessage

    java.lang.Object
      cryptix.message.Message
          cryptix.message.LiteralMessage

public abstract class LiteralMessage
extends Message

Message containing encoded 'literal data'.

This method can transparantly handle both binary and text data, the difference between the two being that text data is usually encoded in a format specific way. E.g. for OpenPGP this is UTF-8.

Version:
  $Revision: 1.2 $
Author:
  Edwin Woudt

Field Summary
`static int` | `BINARY` Returned by getDataType() when the contained data is in binary format.
`static int` | `TEXT` Returned by getDataType() when the contained data is in text format.
`static int` | `UNKNOWN` Returned by getDataType() when it is unknown if the contained data is in text or binary format.

Constructor Summary
`LiteralMessage(java.lang.String format)` Creates a LiteralMessage of the specified format.

Method Summary
`abstract byte[]` | `getBinaryData()` Returns the data in binary format as an array of bytes.
`abstract java.io.InputStream` | `getBinaryDataInputStream()` Returns the data in binary format trough an inputstream.
`abstract int` | `getDataType()` Returns the type of data contained within this message.
`abstract java.lang.String` | `getTextData()` Returns the data in text format as a string.
`abstract java.io.Reader` | `getTextDataReader()` Returns the data in text format as a character reader.

Methods inherited from class cryptix.message.Message
`equals, getAttribute, getEncoded, getFormat, hashCode`

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

Field Detail

### UNKNOWN

    public static final int UNKNOWN

  Returned by getDataType() when it is unknown if the contained data is in text or binary format.

  This usually happens because the underlying format does not store this information. When this happens, support for retrieving the data in binary format must be supported by the implementing class, while support for retrieving data in text format is optional.

  See Also:
    Constant Field Values

### BINARY

    public static final int BINARY

  Returned by getDataType() when the contained data is in binary format.

  See Also:
    Constant Field Values

### TEXT

    public static final int TEXT

  Returned by getDataType() when the contained data is in text format.

  See Also:
    Constant Field Values

Constructor Detail

### LiteralMessage

    public LiteralMessage(java.lang.String format)

  Creates a LiteralMessage of the specified format.

Method Detail

### getDataType

    public abstract int getDataType()

  Returns the type of data contained within this message.

  Can be one of UNKNOWN, BINARY and TEXT.

  If the returned type is UNKNOWN, then usually the underlying format does not store this information. When this happens, support for retrieving the data in binary format must be supported by the implementing class, while support for retrieving data in text format is optional.

### getBinaryData

    public abstract byte[] getBinaryData()
                                  throws java.lang.UnsupportedOperationException,
                                         MessageException

  Returns the data in binary format as an array of bytes.

  MUST be supported when getDataType() returns BINARY or UNKNOWN.
  MAY be supported when getDataType() returns TEXT.

  Throws:
    `java.lang.UnsupportedOperationException` - when this particular operation is not supported. See above for restrictions on when an implementing class is allowed to throw this exception.
    `MessageException` - on a variety of format specific problems.

### getBinaryDataInputStream

    public abstract java.io.InputStream getBinaryDataInputStream()
                                                          throws java.lang.UnsupportedOperationException,
                                                                 MessageException

  Returns the data in binary format trough an inputstream.

  MUST be supported when getDataType() returns BINARY or UNKNOWN.
  MAY be supported when getDataType() returns TEXT.

  Throws:
    `java.lang.UnsupportedOperationException` - when this particular operation is not supported. See above for restrictions on when an implementing class is allowed to throw this exception.
    `MessageException` - on a variety of format specific problems.

### getTextData

    public abstract java.lang.String getTextData()
                                          throws java.lang.UnsupportedOperationException,
                                                 MessageException

  Returns the data in text format as a string.

  MUST be supported when getDataType() returns TEXT.
  MAY be supported when getDataType() returns BINARY or UNKNOWN.

  Throws:
    `java.lang.UnsupportedOperationException` - when this particular operation is not supported. See above for restrictions on when an implementing class is allowed to throw this exception.
    `MessageException` - on a variety of format specific problems.

### getTextDataReader

    public abstract java.io.Reader getTextDataReader()
                                              throws java.lang.UnsupportedOperationException,
                                                     MessageException

  Returns the data in text format as a character reader.

  MUST be supported when getDataType() returns TEXT.
  MAY be supported when getDataType() returns BINARY or UNKNOWN.

  Throws:
    `java.lang.UnsupportedOperationException` - when this particular operation is not supported. See above for restrictions on when an implementing class is allowed to throw this exception.
    `MessageException` - on a variety of format specific problems.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Cryptix OpenPGP
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) 1999-2003 The Cryptix Foundation Ltd.