Class Bodypart
- java.lang.Object
-
- com.isode.x400.highlevel.Bodypart
-
- Direct Known Subclasses:
BodypartForwardedMessage
,BodypartFTBP
,BodypartGeneralText
,BodypartIA5Text
,BodypartTeletex
public class Bodypart extends java.lang.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Bodypart.Bodypart_Type
-
Field Summary
Fields Modifier and Type Field Description int
bodypart_size
The size of the bodypart, in bytesBodypart.Bodypart_Type
bodypart_type
The type that identifies this bodypart
-
Constructor Summary
Constructors Constructor Description Bodypart(Bodypart.Bodypart_Type type)
Create a brand new Bodypart objectBodypart(BodyPart bp_obj)
Create a new Bodypart using an existingBodyPart
object, which is the one used by the standard X.400 Java API.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BodyPart
getBodypartObject()
Returns the standard X.400 API bodypart object, that may be needed for advanced processingbyte[]
getByteParam(int param)
Returns a byte array parameter value in the bodypart object.int
getIntParam(int param)
Returns an integer parameter value in the bodypart object.int
getSize()
Returns the size of message bodypart in bytes.java.lang.String
getStringParam(int param)
Returns a String parameter value in the bodypart object An exception is thrown if the value cannot be read.Bodypart.Bodypart_Type
getType()
Returns the type of message bodypart as a Bodypart_Typejava.lang.String
getTypeAsString()
Returns the type of message bodypartvoid
saveBP(java.lang.String filename)
Save this Bodypart to a file.void
setByteParam(int param, byte[] value)
Sets a byte array parameter value in the bodypart object.void
setIntParam(int param, int value)
Sets an integer parameter value in the bodypart object.void
setSize(int bs)
Sets the size of message bodypart in bytesvoid
setStringParam(int param, java.lang.String value)
Sets a String parameter value in the bodypart object.
-
-
-
Field Detail
-
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 Detail
-
Bodypart
public Bodypart(Bodypart.Bodypart_Type type) throws X400APIException
Create a brand new Bodypart object- Parameters:
type
-Bodypart_Type
identifying the type of the body part to create.- Throws:
X400APIException
-
Bodypart
public Bodypart(BodyPart bp_obj) throws X400APIException
Create a new Bodypart using an existingBodyPart
object, which is the one used by the standard X.400 Java API.- Parameters:
bp_obj
- The BodyPart object needed to create it.- Throws:
X400APIException
-
-
Method Detail
-
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 inX400_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 inX400_attConstants
- Throws:
X400APIException
-
setStringParam
public void setStringParam(int param, java.lang.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 inX400_attConstants
value
-- Throws:
X400APIException
-
getStringParam
public java.lang.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 inX400_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 inX400_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 inX400_attConstants
- Throws:
X400APIException
-
getType
public Bodypart.Bodypart_Type getType()
Returns the type of message bodypart as a Bodypart_Type
-
getTypeAsString
public java.lang.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(java.lang.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
-
-