Class Bodypart
- Direct Known Subclasses:
 BodypartForwardedMessage,BodypartFTBP,BodypartGeneralText,BodypartIA5Text,BodypartTeletex
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 - 
Field Summary
FieldsModifier and TypeFieldDescriptionintThe size of the bodypart, in bytesThe type that identifies this bodypart - 
Constructor Summary
ConstructorsConstructorDescriptionCreate a brand new Bodypart objectCreate a new Bodypart using an existingBodyPartobject, which is the one used by the standard X.400 Java API. - 
Method Summary
Modifier and TypeMethodDescriptionReturns 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.intgetIntParam(int param) Returns an integer parameter value in the bodypart object.intgetSize()Returns the size of message bodypart in bytes.getStringParam(int param) Returns a String parameter value in the bodypart object An exception is thrown if the value cannot be read.getType()Returns the type of message bodypart as a Bodypart_TypeReturns the type of message bodypartvoidSave this Bodypart to a file.voidsetByteParam(int param, byte[] value) Sets a byte array parameter value in the bodypart object.voidsetIntParam(int param, int value) Sets an integer parameter value in the bodypart object.voidsetSize(int bs) Sets the size of message bodypart in bytesvoidsetStringParam(int param, String value) Sets a String parameter value in the bodypart object. 
- 
Field Details
- 
bodypart_type
The type that identifies this bodypart - 
bodypart_size
public int bodypart_sizeThe size of the bodypart, in bytes 
 - 
 - 
Constructor Details
- 
Bodypart
Create a brand new Bodypart object- Parameters:
 type-Bodypart_Typeidentifying the type of the body part to create.- Throws:
 X400APIException
 - 
Bodypart
Create a new Bodypart using an existingBodyPartobject, 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 Details
- 
getBodypartObject
Returns the standard X.400 API bodypart object, that may be needed for advanced processing - 
setIntParam
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_attConstantsvalue-- Throws:
 X400APIException
 - 
getIntParam
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
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_attConstantsvalue-- Throws:
 X400APIException
 - 
getStringParam
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
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_attConstantsvalue-- Throws:
 X400APIException
 - 
getByteParam
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_DATAparameter. 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
Returns the type of message bodypart as a Bodypart_Type - 
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
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
 
 -