NIMSDK-AOS  9.15.0
静态 Public 成员函数 | 所有成员列表
com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder类 参考

聊天室消息构造器 更多...

静态 Public 成员函数

static ChatRoomMessage createChatRoomTextMessage (String roomId, String text)
 创建普通文本消息 更多...
 
static ChatRoomMessage createChatRoomCustomMessage (String roomId, MsgAttachment attachment)
 创建自定义消息 更多...
 
static ChatRoomMessage createChatRoomCustomMessage (String roomId, MsgAttachment attachment, String nosTokenScene)
 创建自定义消息 另外指定指定文件上传(如果有)时使用的 nos scene 更多...
 
static ChatRoomMessage createChatRoomImageMessage (String roomId, File file, String displayName)
 创建一条图片消息 更多...
 
static ChatRoomMessage createChatRoomImageMessage (Context context, String roomId, Uri uri, String displayName)
 创建一条图片消息 更多...
 
static ChatRoomMessage createChatRoomImageMessage (String roomId, File file, String displayName, String nosTokenSceneKey)
 创建一条图片消息 并指定图片上传时使用的 nos scene 更多...
 
static ChatRoomMessage createChatRoomImageMessage (Context context, String roomId, Uri uri, String displayName, String nosTokenSceneKey)
 创建一条图片消息 并指定图片上传时使用的 nos scene 更多...
 
static ChatRoomMessage createChatRoomAudioMessage (String roomId, File file, long duration)
 创建一条音频消息 更多...
 
static ChatRoomMessage createChatRoomAudioMessage (Context context, String roomId, Uri uri, long duration)
 创建一条音频消息 更多...
 
static ChatRoomMessage createChatRoomAudioMessage (String roomId, File file, long duration, String nosTokenSceneKey)
 创建一条音频消息 并指定音频文件上传时使用的 nos scene 更多...
 
static ChatRoomMessage createChatRoomAudioMessage (Context context, String roomId, Uri uri, long duration, String nosTokenSceneKey)
 创建一条音频消息 并指定音频文件上传时使用的 nos scene 更多...
 
static ChatRoomMessage createChatRoomLocationMessage (String roomId, double lat, double lng, String addr)
 创建一条地理位置信息 更多...
 
static ChatRoomMessage createChatRoomVideoMessage (String roomId, File file, long duration, int width, int height, String displayName)
 创建一条视频消息 更多...
 
static ChatRoomMessage createChatRoomVideoMessage (Context context, String roomId, Uri uri, long duration, int width, int height, String displayName)
 创建一条视频消息 更多...
 
static ChatRoomMessage createChatRoomVideoMessage (String roomId, File file, long duration, int width, int height, String displayName, String nosTokenSceneKey)
 创建一条视频消息 并指定视频文件上传时使用的 nos scene 更多...
 
static ChatRoomMessage createChatRoomVideoMessage (Context context, String roomId, Uri uri, long duration, int width, int height, String displayName, String nosTokenSceneKey)
 创建一条视频消息 并指定视频文件上传时使用的 nos scene 更多...
 
static ChatRoomMessage createChatRoomFileMessage (String roomId, File file, String displayName)
 创建一条文件消息 更多...
 
static ChatRoomMessage createChatRoomFileMessage (Context context, String roomId, Uri uri, String displayName)
 创建一条文件消息 并指定文件上传时使用的 nos scene 更多...
 
static ChatRoomMessage createChatRoomFileMessage (String roomId, File file, String displayName, String nosTokenSceneKey)
 创建一条文件消息 并指定文件上传时使用的 nos scene 更多...
 
static ChatRoomMessage createChatRoomFileMessage (Context context, String roomId, Uri uri, String displayName, String nosTokenSceneKey)
 创建一条文件消息 并指定文件上传时使用的 nos scene 更多...
 
static ChatRoomMessage createChatRoomSpatialLocationTextMessage (String roomId, String text, Double x, Double y, Double z)
 创建普通文本消息 更多...
 
static ChatRoomMessage createTipMessage (String roomId)
 创建一条提醒消息 更多...
 
static ChatRoomMessage createRobotMessage (String roomId, String robotAccount, String text, String type, String content, String target, String params)
 
static ChatRoomMessage createEmptyChatRoomMessage (String roomId, long time)
 创建一条空消息,仅设置了房间ID以及时间点,用于记录查询 更多...
 

详细描述

聊天室消息构造器

在文件 ChatRoomMessageBuilder.java32 行定义.

成员函数说明

◆ createChatRoomAudioMessage() [1/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomAudioMessage ( String  roomId,
File  file,
long  duration 
)
static

创建一条音频消息

参数
roomId聊天室ID
file音频文件对象
duration音频文件持续时间,单位是ms
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java152 行定义.

◆ createChatRoomAudioMessage() [2/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomAudioMessage ( Context  context,
String  roomId,
Uri  uri,
long  duration 
)
static

创建一条音频消息

参数
contextContext
roomId聊天室ID
uri音频文件uri
duration音频文件持续时间,单位是ms
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java165 行定义.

◆ createChatRoomAudioMessage() [3/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomAudioMessage ( String  roomId,
File  file,
long  duration,
String  nosTokenSceneKey 
)
static

创建一条音频消息 并指定音频文件上传时使用的 nos scene

参数
roomId聊天室ID
file音频文件对象
duration音频文件持续时间,单位是ms
nosTokenSceneKey音频文件上传时使用的 nos scene ,默认为 NimNosSceneKeyConstant#NIM_DEFAULT_IM
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java178 行定义.

◆ createChatRoomAudioMessage() [4/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomAudioMessage ( Context  context,
String  roomId,
Uri  uri,
long  duration,
String  nosTokenSceneKey 
)
static

创建一条音频消息 并指定音频文件上传时使用的 nos scene

参数
contextContext
roomId聊天室ID
uri音频文件uri
duration音频文件持续时间,单位是ms
nosTokenSceneKey音频文件上传时使用的 nos scene ,默认为 NimNosSceneKeyConstant#NIM_DEFAULT_IM
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java201 行定义.

◆ createChatRoomCustomMessage() [1/2]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomCustomMessage ( String  roomId,
MsgAttachment  attachment 
)
static

创建自定义消息

参数
roomId聊天室ID
attachment消息附件对象
返回
ChatRoomMessage 生成的自定义消息对象

在文件 ChatRoomMessageBuilder.java56 行定义.

◆ createChatRoomCustomMessage() [2/2]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomCustomMessage ( String  roomId,
MsgAttachment  attachment,
String  nosTokenScene 
)
static

创建自定义消息 另外指定指定文件上传(如果有)时使用的 nos scene

参数
roomId聊天室ID
attachment消息附件对象
nosTokenScene文件上传(如果有)时使用的 nos scene
返回
ChatRoomMessage 生成的自定义消息对象

在文件 ChatRoomMessageBuilder.java68 行定义.

◆ createChatRoomFileMessage() [1/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomFileMessage ( String  roomId,
File  file,
String  displayName 
)
static

创建一条文件消息

参数
roomId聊天室ID
file文件
displayName文件的显示名,可不同于文件名
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java325 行定义.

◆ createChatRoomFileMessage() [2/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomFileMessage ( Context  context,
String  roomId,
Uri  uri,
String  displayName 
)
static

创建一条文件消息 并指定文件上传时使用的 nos scene

参数
contextContext
roomId聊天室ID
uri文件uri
displayName文件的显示名,可不同于文件名
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java338 行定义.

◆ createChatRoomFileMessage() [3/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomFileMessage ( String  roomId,
File  file,
String  displayName,
String  nosTokenSceneKey 
)
static

创建一条文件消息 并指定文件上传时使用的 nos scene

参数
roomId聊天室ID
file文件
displayName文件的显示名,可不同于文件名
nosTokenSceneKey文件上传时使用的 nos scene ,默认为 NimNosSceneKeyConstant#NIM_DEFAULT_IM
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java356 行定义.

◆ createChatRoomFileMessage() [4/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomFileMessage ( Context  context,
String  roomId,
Uri  uri,
String  displayName,
String  nosTokenSceneKey 
)
static

创建一条文件消息 并指定文件上传时使用的 nos scene

参数
contextContext
roomId聊天室ID
uri文件uri
displayName文件的显示名,可不同于文件名
nosTokenSceneKey文件上传时使用的 nos scene ,默认为 NimNosSceneKeyConstant#NIM_DEFAULT_IM
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java375 行定义.

◆ createChatRoomImageMessage() [1/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomImageMessage ( String  roomId,
File  file,
String  displayName 
)
static

创建一条图片消息

参数
roomId聊天室ID
file图片文件
displayName图片文件的显示名,可不同于文件名
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java87 行定义.

◆ createChatRoomImageMessage() [2/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomImageMessage ( Context  context,
String  roomId,
Uri  uri,
String  displayName 
)
static

创建一条图片消息

参数
contextContext
roomId聊天室ID
uri图片uri
displayName图片文件的显示名,可不同于文件名
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java100 行定义.

◆ createChatRoomImageMessage() [3/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomImageMessage ( String  roomId,
File  file,
String  displayName,
String  nosTokenSceneKey 
)
static

创建一条图片消息 并指定图片上传时使用的 nos scene

参数
roomId聊天室ID
file图片文件
displayName图片文件的显示名,可不同于文件名
nosTokenSceneKey图片上传时使用的 nos scene ,默认为 NimNosSceneKeyConstant#NIM_DEFAULT_IM
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java115 行定义.

◆ createChatRoomImageMessage() [4/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomImageMessage ( Context  context,
String  roomId,
Uri  uri,
String  displayName,
String  nosTokenSceneKey 
)
static

创建一条图片消息 并指定图片上传时使用的 nos scene

参数
roomId聊天室ID
uri图片文件uri
displayName图片文件的显示名,可不同于文件名
nosTokenSceneKey图片上传时使用的 nos scene ,默认为 NimNosSceneKeyConstant#NIM_DEFAULT_IM
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java134 行定义.

◆ createChatRoomLocationMessage()

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomLocationMessage ( String  roomId,
double  lat,
double  lng,
String  addr 
)
static

创建一条地理位置信息

参数
roomId聊天室ID
lat维度
lng经度
addr地理位置描述信息
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java222 行定义.

◆ createChatRoomSpatialLocationTextMessage()

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomSpatialLocationTextMessage ( String  roomId,
String  text,
Double  x,
Double  y,
Double  z 
)
static

创建普通文本消息

参数
roomId聊天室ID
text文本消息内容
x坐标X
y坐标Y
z坐标Z
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java394 行定义.

◆ createChatRoomTextMessage()

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomTextMessage ( String  roomId,
String  text 
)
static

创建普通文本消息

参数
roomId聊天室ID
text文本消息内容
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java41 行定义.

◆ createChatRoomVideoMessage() [1/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomVideoMessage ( String  roomId,
File  file,
long  duration,
int  width,
int  height,
String  displayName 
)
static

创建一条视频消息

参数
roomId聊天室ID
file视频文件对象
duration视频文件持续时间
width视频宽度
height视频高度
displayName视频文件显示名,可以为空
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java247 行定义.

◆ createChatRoomVideoMessage() [2/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomVideoMessage ( Context  context,
String  roomId,
Uri  uri,
long  duration,
int  width,
int  height,
String  displayName 
)
static

创建一条视频消息

参数
contextContext
roomId聊天室ID
uri视频文件uri
duration视频文件持续时间
width视频宽度
height视频高度
displayName视频文件显示名,可以为空
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java263 行定义.

◆ createChatRoomVideoMessage() [3/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomVideoMessage ( String  roomId,
File  file,
long  duration,
int  width,
int  height,
String  displayName,
String  nosTokenSceneKey 
)
static

创建一条视频消息 并指定视频文件上传时使用的 nos scene

参数
roomId聊天室ID
file视频文件对象
duration视频文件持续时间
width视频宽度
height视频高度
displayName视频文件显示名,可以为空
nosTokenSceneKey视频文件上传时使用的 nos scene ,默认为 NimNosSceneKeyConstant#NIM_DEFAULT_IM
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java279 行定义.

◆ createChatRoomVideoMessage() [4/4]

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createChatRoomVideoMessage ( Context  context,
String  roomId,
Uri  uri,
long  duration,
int  width,
int  height,
String  displayName,
String  nosTokenSceneKey 
)
static

创建一条视频消息 并指定视频文件上传时使用的 nos scene

参数
contextContext
roomId聊天室ID
uri视频文件uri
duration视频文件持续时间
width视频宽度
height视频高度
displayName视频文件显示名,可以为空
nosTokenSceneKey视频文件上传时使用的 nos scene ,默认为 NimNosSceneKeyConstant#NIM_DEFAULT_IM
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java305 行定义.

◆ createEmptyChatRoomMessage()

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createEmptyChatRoomMessage ( String  roomId,
long  time 
)
static

创建一条空消息,仅设置了房间ID以及时间点,用于记录查询

参数
time查询的时间起点信息
返回
空消息

在文件 ChatRoomMessageBuilder.java456 行定义.

◆ createRobotMessage()

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createRobotMessage ( String  roomId,
String  robotAccount,
String  text,
String  type,
String  content,
String  target,
String  params 
)
static
参数
roomId聊天室ID
robotAccount机器人账号
text消息显示的文案,一般基于content加上@机器人的标签作为消息显示的文案。
type机器人消息类型,参考com.netease.nimlib.sdk.robot.model.RobotMsgType
content消息内容,如果消息类型是com.netease.nimlib.sdk.robot.model.RobotMsgType#TEXT,必须传入说话内容
target如果消息类型是com.netease.nimlib.sdk.robot.model.RobotMsgType#LINK, 必须传入跳转目标
params如果消息类型是com.netease.nimlib.sdk.robot.model.RobotMsgType#LINK时,可能需要传入参数
返回
机器人消息

在文件 ChatRoomMessageBuilder.java427 行定义.

◆ createTipMessage()

static ChatRoomMessage com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder.createTipMessage ( String  roomId)
static

创建一条提醒消息

参数
roomId聊天室ID
返回
ChatRoomMessage 生成的聊天室消息对象

在文件 ChatRoomMessageBuilder.java410 行定义.


该类的文档由以下文件生成: