nan.model
Class Attachment

java.lang.Object
  extended bynan.model.Attachment
All Implemented Interfaces:
XMLSerializable

public class Attachment
extends java.lang.Object
implements XMLSerializable

An NNTP Message attachment.

Version:
1.2, 1/5/04
Author:
John David Ratliff

Field Summary
static java.lang.String XML_DATA
          XML tag for data property.
static java.lang.String XML_NAME
          XML tag for name property.
static java.lang.String XML_TAG
          XML tag for serialization.
 
Constructor Summary
protected Attachment()
          Creates a new Attachment object.
  Attachment(java.lang.String name, java.lang.String data)
          Creates a new Attachment object.
 
Method Summary
 byte[] decode()
          Decodes and returns the data for this attachment.
static Attachment encode(java.io.File file)
          Encodes a file to an Attachment.
 java.lang.String getData()
          Gets the Base64 encoded data of this attachment.
 java.lang.String getName()
          Gets the name of this attachment.
 java.lang.String getUUEData()
          Returns this Attachment as a UUEncoded document.
protected  void setData(java.lang.String data)
          Sets the Base64 encoded data of this attachment.
protected  void setName(java.lang.String name)
          Sets the name of this attachment.
 java.lang.String toString()
          Returns a String representation of this attachment.
 org.dom4j.Document toXML()
          Converts an object into an XML Document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XML_TAG

public static final java.lang.String XML_TAG
XML tag for serialization.

See Also:
Constant Field Values

XML_NAME

public static final java.lang.String XML_NAME
XML tag for name property.

See Also:
Constant Field Values

XML_DATA

public static final java.lang.String XML_DATA
XML tag for data property.

See Also:
Constant Field Values
Constructor Detail

Attachment

public Attachment(java.lang.String name,
                  java.lang.String data)
Creates a new Attachment object.

Parameters:
name - The name of the attachment.
data - The Base64 encoded data.

Attachment

protected Attachment()
Creates a new Attachment object.

Method Detail

getName

public java.lang.String getName()
Gets the name of this attachment.

Returns:
The name.

setName

protected void setName(java.lang.String name)
Sets the name of this attachment.

Parameters:
name - The name.

getData

public java.lang.String getData()
Gets the Base64 encoded data of this attachment.

Returns:
The Base64 encoded data.

setData

protected void setData(java.lang.String data)
Sets the Base64 encoded data of this attachment.

Parameters:
data - The Base64 encoded data.

getUUEData

public java.lang.String getUUEData()
Returns this Attachment as a UUEncoded document.

Returns:
The UUE String.

decode

public byte[] decode()
Decodes and returns the data for this attachment.

Returns:
The unencoded data.

encode

public static Attachment encode(java.io.File file)
Encodes a file to an Attachment.

Parameters:
file - The file to encode.
Returns:
The Attachment.

toXML

public org.dom4j.Document toXML()
Converts an object into an XML Document.

Specified by:
toXML in interface XMLSerializable
Returns:
The XML Document.

toString

public java.lang.String toString()
Returns a String representation of this attachment.

Returns:
A String representation.