FileDocCategorySizeDatePackage
AttachmentInfo.javaAPI DocGlassfish v2 API4560Mon Oct 17 14:54:28 BST 2005demo

AttachmentInfo

public class AttachmentInfo extends Object
Used to store attachment information.

Fields Summary
private Part
part
private int
num
Constructors Summary
Methods Summary
public java.lang.StringgetAttachmentType()
Returns the attachment's content type.

        String contentType;
        if ((contentType = part.getContentType()) == null)
            return "invalid part";
        else
	    return contentType;
    
public java.lang.StringgetContent()
Returns the attachment's content (if it is plain text).

        if (hasMimeType("text/plain"))
            return (String)part.getContent();
        else
            return "";
    
public java.lang.StringgetDescription()
Returns the attachment's description.

        String description;
        if ((description = part.getDescription()) != null)
            return description;
        else 
            return "";
    
public java.lang.StringgetFilename()
Returns the attachment's filename.

        String filename;
        if ((filename = part.getFileName()) != null)
            return filename;
        else
            return "";
    
public java.lang.StringgetNum()
Returns the attachment number.

        return (Integer.toString(num));
    
public booleanhasDescription()
Method for checking if the attachment has a description.

        return (part.getDescription() != null);
    
public booleanhasFilename()
Method for checking if the attachment has a filename.

        return (part.getFileName() != null);
    
public booleanhasMimeType(java.lang.String mimeType)
Method for checking if the attachment has the desired mime type.

        return part.isMimeType(mimeType);
    
public booleanisInline()
Method for checking the content disposition.

        if (part.getDisposition() != null)
            return part.getDisposition().equals(Part.INLINE);
        else
            return true;
    
public voidsetPart(int num, javax.mail.Part part)
Method for mapping a message part to this AttachmentInfo class.

            
        this.part = part;
        this.num = num;