NIMSDK-AOS  9.16.3
ChatRoomInfo.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.chatroom.model;
2 
3 import android.os.Parcel;
4 import android.os.Parcelable;
5 
6 import com.netease.nimlib.session.MsgHelper;
7 
8 import java.io.Serializable;
9 import java.util.Map;
10 
14 public class ChatRoomInfo implements Serializable, Parcelable {
15  private String roomId; // roomId
16  private String name; // 聊天室名称
17  private String announcement; // 聊天室公告
18  private String broadcastUrl; // 视频直播拉流地址
19  private String creator; // 聊天室创建者账号
20  private int validFlag; // 聊天室有效标记, 1:有效,0:无效
21  private int onlineUserCount; // 当前在线用户数量
22  private int mute; // 聊天室禁言标记
23  private Map<String, Object> extension; // 第三方扩展字段, 长度4k
24  private int queueLevel; // 队列管理权限,如是否有权限提交他人key和信息到队列中。
25 
26  public ChatRoomInfo() {
27  }
28 
33  public String getRoomId() {
34  return roomId;
35  }
36 
41  public String getName() {
42  return name;
43  }
44 
49  public String getAnnouncement() {
50  return announcement;
51  }
52 
57  public String getBroadcastUrl() {
58  return broadcastUrl;
59  }
60 
65  public String getCreator() {
66  return creator;
67  }
68 
73  public boolean isValid() {
74  return validFlag == 1;
75  }
76 
81  public Map<String, Object> getExtension() {
82  return extension;
83  }
84 
89  public int getOnlineUserCount() {
90  return onlineUserCount;
91  }
92 
97  public boolean isMute() {
98  return mute == 0x01;
99  }
100 
105  public void setRoomId(String roomId) {
106  this.roomId = roomId;
107  }
108 
113  public void setName(String name) {
114  this.name = name;
115  }
116 
121  public void setAnnouncement(String announcement) {
122  this.announcement = announcement;
123  }
124 
129  public void setBroadcastUrl(String broadcastUrl) {
130  this.broadcastUrl = broadcastUrl;
131  }
132 
137  public void setCreator(String creator) {
138  this.creator = creator;
139  }
140 
145  public void setValidFlag(int validFlag) {
146  this.validFlag = validFlag;
147  }
148 
153  public void setExtension(Map<String, Object> extension) {
154  this.extension = extension;
155  }
156 
161  public void setOnlineUserCount(int onlineUserCount) {
162  this.onlineUserCount = onlineUserCount;
163  }
164 
169  public void setMute(int mute) {
170  this.mute = mute;
171  }
172 
178  public void setQueueLevel(int queueLevel) {
179  this.queueLevel = queueLevel;
180  }
181 
186  public int getQueueLevel() {
187  return queueLevel;
188  }
189 
193  protected ChatRoomInfo(Parcel in) {
194  roomId = in.readString();
195  name = in.readString();
196  announcement = in.readString();
197  broadcastUrl = in.readString();
198  creator = in.readString();
199  validFlag = in.readInt();
200  onlineUserCount = in.readInt();
201  setExtension(MsgHelper.getMapFromJsonString(in.readString()));
202  mute = in.readInt();
203  queueLevel = in.readInt();
204  }
205 
206  @Override
207  public int describeContents() {
208  return 0;
209  }
210 
211  @Override
212  public void writeToParcel(Parcel dest, int flags) {
213  dest.writeString(roomId);
214  dest.writeString(name);
215  dest.writeString(announcement);
216  dest.writeString(broadcastUrl);
217  dest.writeString(creator);
218  dest.writeInt(validFlag);
219  dest.writeInt(onlineUserCount);
220  dest.writeString(MsgHelper.getJsonStringFromMap(extension));
221  dest.writeInt(mute);
222  dest.writeInt(queueLevel);
223  }
224 
225  public static final Creator<ChatRoomInfo> CREATOR = new Creator<ChatRoomInfo>() {
226  @Override
227  public ChatRoomInfo createFromParcel(Parcel in) {
228  return new ChatRoomInfo(in);
229  }
230 
231  @Override
232  public ChatRoomInfo[] newArray(int size) {
233  return new ChatRoomInfo[size];
234  }
235  };
236 }
void setOnlineUserCount(int onlineUserCount)
设置当前在线用户数量
ChatRoomInfo(Parcel in)
********************************** 序列化 **********************************
void setCreator(String creator)
设置聊天室创建者
String getCreator()
获取聊天室创建者帐号
String getAnnouncement()
获取聊天室公告
void setBroadcastUrl(String broadcastUrl)
设置聊天室直播拉流地址
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 setExtension(Map< String, Object > extension)
设置扩展字段