NIMSDK-AOS  10.6.0
ChatRoomInfo.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.chatroom.model;
2 
3 import android.os.Parcel;
4 import android.os.Parcelable;
5 import com.netease.nimlib.session.MsgHelper;
6 import java.io.Serializable;
7 import java.util.Map;
8 
12 public class ChatRoomInfo implements Serializable, Parcelable {
13  private String roomId; // roomId
14  private String name; // 聊天室名称
15  private String announcement; // 聊天室公告
16  private String broadcastUrl; // 视频直播拉流地址
17  private String creator; // 聊天室创建者账号
18  private int validFlag; // 聊天室有效标记, 1:有效,0:无效
19  private int onlineUserCount; // 当前在线用户数量
20  private int mute; // 聊天室禁言标记
21  private Map<String, Object> extension; // 第三方扩展字段, 长度4k
22  private String extensionStr; // 第三方扩展字段, 长度4k
23  private int queueLevel; // 队列管理权限,如是否有权限提交他人key和信息到队列中。
24 
25  public ChatRoomInfo() {
26  }
27 
32  public String getRoomId() {
33  return roomId;
34  }
35 
40  public String getName() {
41  return name;
42  }
43 
48  public String getAnnouncement() {
49  return announcement;
50  }
51 
56  public String getBroadcastUrl() {
57  return broadcastUrl;
58  }
59 
64  public String getCreator() {
65  return creator;
66  }
67 
72  public boolean isValid() {
73  return validFlag == 1;
74  }
75 
80  public Map<String, Object> getExtension() {
81  return extension;
82  }
83 
88  public String getExtensionStr() {
89  return extensionStr;
90  }
91 
96  public int getOnlineUserCount() {
97  return onlineUserCount;
98  }
99 
104  public boolean isMute() {
105  return mute == 0x01;
106  }
107 
112  public void setRoomId(String roomId) {
113  this.roomId = roomId;
114  }
115 
120  public void setName(String name) {
121  this.name = name;
122  }
123 
128  public void setAnnouncement(String announcement) {
129  this.announcement = announcement;
130  }
131 
136  public void setBroadcastUrl(String broadcastUrl) {
137  this.broadcastUrl = broadcastUrl;
138  }
139 
144  public void setCreator(String creator) {
145  this.creator = creator;
146  }
147 
152  public void setValidFlag(int validFlag) {
153  this.validFlag = validFlag;
154  }
155 
160  public void setExtension(Map<String, Object> extension) {
161  this.extension = extension;
162  }
163 
168  public void setExtensionStr(String extensionStr) {
169  this.extensionStr = extensionStr;
170  this.extension = MsgHelper.getMapFromJsonString(extensionStr);
171  }
172 
177  public void setOnlineUserCount(int onlineUserCount) {
178  this.onlineUserCount = onlineUserCount;
179  }
180 
185  public void setMute(int mute) {
186  this.mute = mute;
187  }
188 
194  public void setQueueLevel(int queueLevel) {
195  this.queueLevel = queueLevel;
196  }
197 
202  public int getQueueLevel() {
203  return queueLevel;
204  }
205 
209  protected ChatRoomInfo(Parcel in) {
210  roomId = in.readString();
211  name = in.readString();
212  announcement = in.readString();
213  broadcastUrl = in.readString();
214  creator = in.readString();
215  validFlag = in.readInt();
216  onlineUserCount = in.readInt();
217  setExtensionStr(in.readString());
218  mute = in.readInt();
219  queueLevel = in.readInt();
220  }
221 
222  @Override
223  public int describeContents() {
224  return 0;
225  }
226 
227  @Override
228  public void writeToParcel(Parcel dest, int flags) {
229  dest.writeString(roomId);
230  dest.writeString(name);
231  dest.writeString(announcement);
232  dest.writeString(broadcastUrl);
233  dest.writeString(creator);
234  dest.writeInt(validFlag);
235  dest.writeInt(onlineUserCount);
236  dest.writeString(extensionStr);
237  dest.writeInt(mute);
238  dest.writeInt(queueLevel);
239  }
240 
241  public static final Creator<ChatRoomInfo> CREATOR = new Creator<ChatRoomInfo>() {
242  @Override
243  public ChatRoomInfo createFromParcel(Parcel in) {
244  return new ChatRoomInfo(in);
245  }
246 
247  @Override
248  public ChatRoomInfo[] newArray(int size) {
249  return new ChatRoomInfo[size];
250  }
251  };
252 }
void setOnlineUserCount(int onlineUserCount)
设置当前在线用户数量
ChatRoomInfo(Parcel in)
********************************** 序列化 **********************************
void setCreator(String creator)
设置聊天室创建者
String getCreator()
获取聊天室创建者帐号
String getAnnouncement()
获取聊天室公告
void setBroadcastUrl(String broadcastUrl)
设置聊天室直播拉流地址
String getExtensionStr()
获取聊天室扩展字段
void setMute(int mute)
设置当前聊天室禁言状态
void setRoomId(String roomId)
设置聊天室id
void setAnnouncement(String announcement)
设置聊天室公告
String getBroadcastUrl()
获取聊天室拉流地址
void setQueueLevel(int queueLevel)
设置队列权限,如是否有权限提交他人key和信息到队列中 0 表示所有人都有权限,1 表示只有主播/管理员有权限...
void setName(String name)
设置聊天室名称
Map< String, Object > getExtension()
获取聊天室扩展字段
void setValidFlag(int validFlag)
设置聊天室有效标记
boolean isValid()
获取聊天室有效标记
boolean isMute()
获取当前聊天室禁言状态
static final Creator< ChatRoomInfo > CREATOR
int getOnlineUserCount()
获取当前在线用户数量
void setExtensionStr(String extensionStr)
设置扩展字段
void setExtension(Map< String, Object > extension)
设置扩展字段