Package com.isode.x400.highlevel
Class BodypartGeneralText
java.lang.Object
com.isode.x400.highlevel.Bodypart
com.isode.x400.highlevel.BodypartGeneralText
This class represents a General Text bodypart.
When creating an instance of this class, you must provide the charset and the content. You must ensure that the content is correct for the charset.
The charset must be one the ones provided by the class Charset E.g. WEST_EUROPEAN (that maps to "1 6 100")
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Available charsets to use for General Text bodypartsNested classes/interfaces inherited from class com.isode.x400.highlevel.Bodypart
Bodypart.Bodypart_Type
-
Field Summary
Fields inherited from class com.isode.x400.highlevel.Bodypart
bodypart_size, bodypart_type
-
Constructor Summary
ConstructorsConstructorDescriptionBodypartGeneralText
(boolean iso_8859_1, String ct) Creates a General Text bodypart, with a content suitable for ISO-8895-1 (if iso_8859_1 is true) or ISO-8895-2 (if iso_8859_1 is false).Constructor based on data provided by the user, including the charset and content.BodypartGeneralText
(BodyPart bp_obj) Constructor based on an existing bodypart object, for example, one read from an existing message.BodypartGeneralText
(String charset, String ct) Constructor based on data provided by the user, including the charset and content.BodypartGeneralText
(String charset, String rawContent, boolean emptyCharset) Constructor based on data provided by the user, including the charset as a String and the raw content as a String.BodypartGeneralText
(String fileName, Charset sourceCharacterSet, String isoCharsets) Creates a General Text bodypart which will be encoded using the specified ISO character sets, reading the data for the bodypart from the specified file using the selected encoding. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Returns the charset string of this General Text bodypartint
getSize()
Returns the size, in bytes, of the message bodypart.Returns the string representation of this message bodypart.Returns the content of this General Text bodypartvoid
saveBodypartRaw
(String filename) Save the bodypart in the given filenamevoid
Save the bodypart in the given filenamevoid
Sets the charset of this General Text bodypartvoid
setContentFromFile
(String file) Deprecated.Assumes that input file is UTF-8 encoded, when this may not be truevoid
setSize
(int s) Sets the size of message bodypart in bytes.void
setTextContent
(String ct) Sets the content of this General Text bodypartMethods inherited from class com.isode.x400.highlevel.Bodypart
getBodypartObject, getByteParam, getIntParam, getStringParam, getType, getTypeAsString, setByteParam, setIntParam, setStringParam
-
Constructor Details
-
BodypartGeneralText
Constructor based on an existing bodypart object, for example, one read from an existing message.- Parameters:
bp_obj
-- Throws:
X400APIException
-
BodypartGeneralText
Constructor based on data provided by the user, including the charset and content. For ISO-8895-1 and ISO-8895-2 you can use the constructor BodypartGeneralText(boolean iso1, String ct) specifying true for ISO-8895-1 and false for ISO-8895-2- Parameters:
cs
-ct
-- Throws:
X400APIException
-
BodypartGeneralText
Constructor based on data provided by the user, including the charset and content. For ISO-8895-1 and ISO-8895-2 you can use the constructor BodypartGeneralText(boolean iso1, String ct) specifying true for ISO-8895-1 and false for ISO-8895-2- Parameters:
charset
-ct
-- Throws:
X400APIException
-
BodypartGeneralText
public BodypartGeneralText(String charset, String rawContent, boolean emptyCharset) throws X400APIException Constructor based on data provided by the user, including the charset as a String and the raw content as a String. The emptyCharset boolean method indicates if the charset should be set or not- Parameters:
charset
-rawContent
-emptyCharset
-- Throws:
X400APIException
-
BodypartGeneralText
Creates a General Text bodypart, with a content suitable for ISO-8895-1 (if iso_8859_1 is true) or ISO-8895-2 (if iso_8859_1 is false). The advantage of this method is that there's no need to specify the charset.- Parameters:
iso_8859_1
-ct
-- Throws:
X400APIException
-
BodypartGeneralText
public BodypartGeneralText(String fileName, Charset sourceCharacterSet, String isoCharsets) throws X400APIException Creates a General Text bodypart which will be encoded using the specified ISO character sets, reading the data for the bodypart from the specified file using the selected encoding.- Parameters:
fileName
- name of file to read data fromsourceCharacterSet
- identifies the encoding which the input file usesisoCharsets
- identifies the ISO-2022 character sets to be used by the bodypart- Throws:
X400APIException
-
-
Method Details
-
getCharset
Deprecated.callers should usegetCharsetString()
, which returns all possible charset values in a String.Returns the Charset of this General Text bodypart- Throws:
X400APIException
-
getCharsetString
Returns the charset string of this General Text bodypart- Throws:
X400APIException
-
setCharset
Sets the charset of this General Text bodypart- Parameters:
cs
-- Throws:
X400APIException
-
getTextContent
Returns the content of this General Text bodypart- Throws:
X400APIException
-
setTextContent
Sets the content of this General Text bodypart- Parameters:
ct
-- Throws:
X400APIException
-
setContentFromFile
Deprecated.Assumes that input file is UTF-8 encoded, when this may not be trueSets the content of this General Text bodypart- Parameters:
file
-- Throws:
X400APIException
-
getStringRepresentation
Returns the string representation of this message bodypart.- Throws:
X400APIException
-
getSize
public int getSize()Returns the size, in bytes, of the message bodypart.- Overrides:
getSize
in classBodypart
- Throws:
X400APIException
-
setSize
public void setSize(int s) Sets the size of message bodypart in bytes. -
saveBP
Save the bodypart in the given filename- Overrides:
saveBP
in classBodypart
- Parameters:
filename
-- Throws:
X400APIException
-
saveBodypartRaw
Save the bodypart in the given filename- Parameters:
filename
-- Throws:
IOException
X400APIException
-
getCharsetString()
, which returns all possible charset values in a String.