Package org.linphone.core
Interface Content
public interface Content
This object holds data that can be embedded in a signaling message.
Use
it's type and subtype and fill the buffer with your data.
A
information (name, path, size), be encrypted, have custom headers, etc...
It is mainly used to send information through a
Use
Core.createContent()
to create it, and then you should set at leastit's type and subtype and fill the buffer with your data.
A
Content
can be multipart (contain other contents), have fileinformation (name, path, size), be encrypted, have custom headers, etc...
It is mainly used to send information through a
ChatMessage
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addContentTypeParameter
(String name, String value) Adds a parameter to the ContentType header.void
addCustomHeader
(String headerName, String headerValue) Adds a custom header in a content.Generates a temporary plain copy of the file and returns its paths The caller
is responsible to then delete this temporary copy and the returned string.findPartByHeader
(String headerName, String headerValue) Find a part from a multipart content looking for a part header with a specified
value.byte[]
Get the content data buffer, usually a string.getCustomHeader
(String headerName) Get a custom header value of a content.Get the disposition of the Content, for example "recipient-list".Get the encoding of the data buffer, for example "gzip".int
Gets the file duration in seconds, if information is available.Get the file transfer filepath set for this content (replace
linphone_chat_message_get_file_transfer_filepath).int
Get the file size if content is either a FileContent or a FileTransferContent.getKey()
Get the key associated with a RCS file transfer message if encrypted.int
Get the size of key associated with a RCS file transfer message if encrypted.getName()
Get the name associated with a RCS file transfer message.long
Gets the native pointer used by this class to make native method calls.getPart
(int index) Get a part from a multipart content according to its index.Content[]
getParts()
Get all the parts from a multipart content.Deprecated.2022-01-07.int
getSize()
Get the content data buffer size, excluding null character despite null
character is always set for convenience.Deprecated.2020-07-01.Get the mime subtype of the content data.getType()
Get the mime type of the content data.Gets the object stored in this object user's dataGet the string content data buffer.boolean
isFile()
Tells whether or not this content contains a file.boolean
Tells whether or not this content contains an encrypted file.boolean
Tells whether or not this content is a file transfer.boolean
Tells whether or not this content contains an icalendar by checking it's
content type.boolean
Tell whether a content is a multipart content.boolean
isText()
Tells whether or not this content contains text.boolean
Tells whether or not this content contains a voice recording by checking it's
content type.void
setBuffer
(byte[] buffer, int size) Set the content data buffer, usually a string.void
setDisposition
(String disposition) Set the disposition of the Content, for example "recipient-list".void
setEncoding
(String encoding) Set the encoding of the data buffer, for example "gzip".void
setFilePath
(String filePath) Set the file transfer filepath for this content (replace
linphone_chat_message_set_file_transfer_filepath).void
Set the key associated with a RCS file transfer message if encrypted.void
Set the name associated with a RCS file transfer message.void
setSize
(int size) Set the content data size, excluding null character despite null character is
always set for convenience.void
setStringBuffer
(String buffer) Deprecated.2020-07-01.void
setSubtype
(String subtype) Set the mime subtype of the content data.void
Set the mime type of the content data.void
setUserData
(Object data) Sets the object to store in this object user's datavoid
setUtf8Text
(String buffer) Get the string content data buffer.toString()
-
Method Details
-
getBuffer
@NonNull byte[] getBuffer()Get the content data buffer, usually a string.
- Returns:
- The content data buffer.
-
getDisposition
Get the disposition of the Content, for example "recipient-list".
- Returns:
- The disposition of the Content.
-
setDisposition
Set the disposition of the Content, for example "recipient-list".
- Parameters:
disposition
- The disposition of the Content.
-
getEncoding
Get the encoding of the data buffer, for example "gzip".
- Returns:
- The encoding of the data buffer.
-
setEncoding
Set the encoding of the data buffer, for example "gzip".
- Parameters:
encoding
- The encoding of the data buffer.
-
getFileDuration
int getFileDuration()Gets the file duration in seconds, if information is available.
-
getFilePath
Get the file transfer filepath set for this content (replace
linphone_chat_message_get_file_transfer_filepath).
- Returns:
- The file path set for this content if it has been set, null otherwise.
-
setFilePath
Set the file transfer filepath for this content (replace
linphone_chat_message_set_file_transfer_filepath).
- Parameters:
filePath
- the file transfer filepath.
-
getFileSize
int getFileSize()Get the file size if content is either a FileContent or a FileTransferContent.
- Returns:
- The represented file size.
-
isFile
boolean isFile()Tells whether or not this content contains a file.
- Returns:
- true if this content contains a file, false otherwise.
-
isFileEncrypted
boolean isFileEncrypted()Tells whether or not this content contains an encrypted file.
- Returns:
- True is this content contains a file and this file is encrypted, false
otherwise.
-
isFileTransfer
boolean isFileTransfer()Tells whether or not this content is a file transfer.
- Returns:
- true if this content is a file transfer, false otherwise.
-
isIcalendar
boolean isIcalendar()Tells whether or not this content contains an icalendar by checking it's
content type.
- Returns:
- true if this content type is 'text/calendar;conference-event=yes',
false otherwise.
-
isMultipart
boolean isMultipart()Tell whether a content is a multipart content.
- Returns:
- A boolean value telling whether the content is multipart or not.
-
isText
boolean isText()Tells whether or not this content contains text.
- Returns:
- true if this content contains plain text, false otherwise.
-
isVoiceRecording
boolean isVoiceRecording()Tells whether or not this content contains a voice recording by checking it's
content type.
- Returns:
- true if this content type is 'audio/wav;voice-recording=yes', false
otherwise.
-
getKey
Get the key associated with a RCS file transfer message if encrypted.
- Returns:
- The key to encrypt/decrypt the file associated to this content.
-
getKeySize
int getKeySize()Get the size of key associated with a RCS file transfer message if encrypted.
- Returns:
- The key size in bytes
-
getName
Get the name associated with a RCS file transfer message.
It is used to store the original filename of the file to be downloaded from
server.- Returns:
- The name of the content.
-
setName
Set the name associated with a RCS file transfer message.
It is used to store the original filename of the file to be downloaded from
server.- Parameters:
name
- The name of the content.
-
getParts
Get all the parts from a multipart content.
- Returns:
- A object holding the part if found, null otherwise.
-
getPlainFilePath
Deprecated.2022-01-07. UseexportPlainFile()
instead.Generates a temporary plain copy of the file and returns its paths The caller
is responsible to then delete this temporary copy and the returned string.
- Returns:
- The file path set for this content if it has been set, null otherwise.
-
getSize
int getSize()Get the content data buffer size, excluding null character despite null
character is always set for convenience.
- Returns:
- The content data buffer size.
-
setSize
void setSize(int size) Set the content data size, excluding null character despite null character is
always set for convenience.
- Parameters:
size
- The content data buffer size.
-
getStringBuffer
Deprecated.2020-07-01. UsegetUtf8Text()
instead.Get the string content data buffer.
- Returns:
- The string content data buffer.
-
setStringBuffer
Deprecated.2020-07-01. UsesetUtf8Text(java.lang.String)
instead.Set the string content data buffer.
- Parameters:
buffer
- The string content data buffer in UTF8.
-
getSubtype
Get the mime subtype of the content data.
- Returns:
- The mime subtype of the content data, for example "html".
-
setSubtype
Set the mime subtype of the content data.
- Parameters:
subtype
- The mime subtype of the content data, for example "html".
-
getType
Get the mime type of the content data.
- Returns:
- The mime type of the content data, for example "application".
-
setType
Set the mime type of the content data.
- Parameters:
type
- The mime type of the content data, for example "application".
-
getUtf8Text
Get the string content data buffer.
Introduced in 01/07/2020- Returns:
- The string content data buffer in UTF8.
-
setUtf8Text
Get the string content data buffer.
Introduced in 01/07/2020- Parameters:
buffer
- The string content data buffer in UTF8.
-
addContentTypeParameter
Adds a parameter to the ContentType header.
- Parameters:
name
- the name of the parameter to add.value
- the value of the parameter to add.
-
addCustomHeader
Adds a custom header in a content.
- Parameters:
headerName
- The name of the header to add.headerValue
- The value of the header to add.
-
exportPlainFile
String exportPlainFile()Generates a temporary plain copy of the file and returns its paths The caller
is responsible to then delete this temporary copy and the returned string.
- Returns:
- The file path set for this content if it has been set, null otherwise.
-
findPartByHeader
Find a part from a multipart content looking for a part header with a specified
value.
- Parameters:
headerName
- The name of the header to look for.headerValue
- The value of the header to look for.- Returns:
- A
Content
object object the part if found, null otherwise.
-
getCustomHeader
Get a custom header value of a content.
- Parameters:
headerName
- The name of the header to get the value from.- Returns:
- The value of the header if found, null otherwise.
-
getPart
Get a part from a multipart content according to its index.
- Parameters:
index
- The index of the part to get.- Returns:
- A
Content
object holding the part if found, null otherwise.
-
setBuffer
void setBuffer(@NonNull byte[] buffer, int size) Set the content data buffer, usually a string.
- Parameters:
buffer
- The content data buffer.size
- The size of the content data buffer.
-
setKey
Set the key associated with a RCS file transfer message if encrypted.
- Parameters:
key
- The key to be used to encrypt/decrypt file associated to this
content.keyLength
- The lengh of the key.
-
setUserData
Sets the object to store in this object user's data- Parameters:
data
- the object to store
-
getUserData
Object getUserData()Gets the object stored in this object user's data- Returns:
- the object store if any, null otherwise
-
getNativePointer
long getNativePointer()Gets the native pointer used by this class to make native method calls.- Returns:
- the nativer pointer, as long
-
toString
String toString()
-