Class Bodypart

java.lang.Object
com.isode.x400.highlevel.Bodypart
Direct Known Subclasses:
BodypartForwardedMessage, BodypartFTBP, BodypartGeneralText, BodypartIA5Text, BodypartTeletex

public class Bodypart extends Object
Represents a message bodypart, which is one instance of possible several pieces of information associated with a single message.

Bodyparts have a series of common attributes, like the type and size, that can be accessed in a common way.

Some specific bodyparts inherit from this class, and provide other methods to access things like file name or character sets. This class should not be confused with the similarly named BodyPart class, which is part of the "standard" X.400. This class contains an object of BodyPart class.

  • Field Details

    • bodypart_type

      public Bodypart.Bodypart_Type bodypart_type
      The type that identifies this bodypart
    • bodypart_size

      public int bodypart_size
      The size of the bodypart, in bytes
  • Constructor Details

  • Method Details

    • getBodypartObject

      public BodyPart getBodypartObject()
      Returns the standard X.400 API bodypart object, that may be needed for advanced processing
    • setIntParam

      public void setIntParam(int param, int value) throws X400APIException
      Sets an integer parameter value in the bodypart object. An exception is thrown if the value cannot be set.

      This method assumes that you know what is the int value associated with the parameter that you want to set, and what is a valid value to associate with it.

      Parameters:
      param - The param is one of the parameters listed in X400_attConstants
      value -
      Throws:
      X400APIException
    • getIntParam

      public int getIntParam(int param) throws X400APIException
      Returns an integer parameter value in the bodypart object. If the parameter is not present, then -1 is returned. An exception is thrown if the value cannot be read for any other reason.

      This method assumes that you know what is the int value associated with the parameter that you want to read

      Parameters:
      param - The param is one of the parameters listed in X400_attConstants
      Throws:
      X400APIException
    • setStringParam

      public void setStringParam(int param, String value) throws X400APIException
      Sets a String parameter value in the bodypart object. An exception is thrown if the value cannot be set.

      This method assumes that you know what is the int value associated with the parameter that you want to set, and what is a valid value to associate with it.

      Parameters:
      param - The param is one of the parameters listed in X400_attConstants
      value -
      Throws:
      X400APIException
    • getStringParam

      public String getStringParam(int param) throws X400APIException
      Returns a String parameter value in the bodypart object An exception is thrown if the value cannot be read.

      This method assumes that you know what is the int value associated with the parameter that you want to read

      Parameters:
      param - The param is one of the parameters listed in X400_attConstants
      Throws:
      X400APIException
    • setByteParam

      public void setByteParam(int param, byte[] value) throws X400APIException
      Sets a byte array parameter value in the bodypart object. An exception is thrown if the value cannot be set.

      This method assumes that you know what is the int value associated with the parameter that you want to set, and what is a valid value to associate with it.

      Parameters:
      param - The param is one of the parameters listed in X400_attConstants
      value -
      Throws:
      X400APIException
    • getByteParam

      public byte[] getByteParam(int param) throws X400APIException
      Returns a byte array parameter value in the bodypart object.

      This method assumes that you know what is the int value associated with the parameter that you want to read

      Normally used only for FTBP and Binary bodyparts, to read the X400_att.X400_S_BODY_DATA parameter. An exception is thrown if the value cannot be read.

      Parameters:
      param - The param is one of the parameters listed in X400_attConstants
      Throws:
      X400APIException
    • getType

      public Bodypart.Bodypart_Type getType()
      Returns the type of message bodypart as a Bodypart_Type
    • getTypeAsString

      public String getTypeAsString()
      Returns the type of message bodypart
    • getSize

      public int getSize()
      Returns the size of message bodypart in bytes. If the value is not known, return -1
    • setSize

      public void setSize(int bs)
      Sets the size of message bodypart in bytes
    • saveBP

      public void saveBP(String filename) throws X400APIException
      Save this Bodypart to a file. Only a subset of supported bodyparts can be saved to a file at present. These include:
      BODYPART_IA5_TEXT
      BODYPART_BINARY
      BODYPART_FTBP
      Parameters:
      filename - : the file where to save the bodypart
      Throws:
      X400APIException