NIMSDK-AOS  10.9.80
Public 成员函数 | 静态 Public 属性 | Protected 成员函数 | Protected 属性 | 所有成员列表
com.netease.nimlib.sdk.msg.attachment.FileAttachment类 参考

带有文件的附件类型的基类 描述文件的相关信息 更多...

类 com.netease.nimlib.sdk.msg.attachment.FileAttachment 继承关系图:
com.netease.nimlib.sdk.msg.attachment.MsgAttachment com.netease.nimlib.sdk.msg.attachment.AudioAttachment com.netease.nimlib.sdk.msg.attachment.ImageAttachment com.netease.nimlib.sdk.msg.attachment.VideoAttachment

Public 成员函数

 FileAttachment ()
 
 FileAttachment (String attach)
 
String getPath ()
 获取文件本地路径,若文件不存在,返回null 更多...
 
String getPathForSave ()
 获取用于保存该文件的位置 更多...
 
String getThumbPath ()
 获取缩略图文件的本地路径,若文件不存在,返回null 更多...
 
String getThumbPathForSave ()
 获取用于保存缩略图文件的位置 更多...
 
void setPath (String path)
 设置文件路径 更多...
 
boolean setUri (Uri uri)
 设置文件uri, 仅支持ContentResolver.SCHEME_FILE类型和ContentResolver.SCHEME_CONTENT类型的uri 仅支持发送消息时使用,接收的消息附件不支持uri 更多...
 
Uri getUri ()
 
long getSize ()
 获取文件大小,单位为byte 更多...
 
void setSize (long size)
 设置文件大小,单位为byte 更多...
 
String getMd5 ()
 获取文件内容MD5 更多...
 
void setMd5 (String md5)
 设置文件内容MD5 更多...
 
String getUrl ()
 获取文件在服务器上的下载url。若文件还未上传,返回null 更多...
 
void setUrl (String url)
 设置文件在服务器上的下载url 更多...
 
String getExtension ()
 获取文件后缀名 更多...
 
void setExtension (String extension)
 设置文件后缀名 更多...
 
String getFileName ()
 获取文件名。 更多...
 
String getDisplayName ()
 获取文件的显示名。可以和文件名不同,仅用于界面展示 更多...
 
void setDisplayName (String displayName)
 设置文件显示名 更多...
 
String getNosTokenSceneKey ()
 获取文件上传时的nos scene 更多...
 
void setNosTokenSceneKey (String nosTokenSceneKey)
 设置文件上传时的nos scene 更多...
 
long getExpire ()
 
boolean isForceUpload ()
 文件是否强制重新上传 更多...
 
void setForceUpload (boolean forceUpload)
 设置文件是否强制重新上传,默认false 更多...
 
String toJson (boolean send)
 将消息附件序列化为字符串,存储到消息数据库或发送到服务器。
更多...
 

静态 Public 属性

static final String KEY_DOT = "."
 
static final String KEY_PATH = "path"
 
static final String KEY_NAME = "name"
 
static final String KEY_SIZE = "size"
 
static final String KEY_MD5 = "md5"
 
static final String KEY_URL = "url"
 
static final String KEY_EXT = "ext"
 
static final String KEY_SCENE = "sen"
 
static final String KEY_FORCE_UPLOAD = "force_upload"
 
static final String KEY_EXPIRE = "expire"
 
static final String KEY_V2_INTERNAL_UPLOAD_STATE = "KEY_V2_INTERNAL_UPLOAD_STATE"
 

Protected 成员函数

NimStorageType storageType ()
 
void save (JSONObject json)
 
void load (JSONObject json)
 

Protected 属性

String path
 文件路径 更多...
 
long size
 文件大小 更多...
 
String md5
 文件内容的MD5 更多...
 
String url
 文件下载地址 更多...
 
String displayName
 文件显示名 更多...
 
String extension
 文件后缀名 更多...
 
String nosTokenSceneKey = NimNosSceneKeyConstant.NIM_DEFAULT_IM
 上传文件时用的对token对应的场景,默认NimNosSceneKeyConstant#NIM_DEFAULT_IM 更多...
 
boolean forceUpload = false
 如果服务器存在相同的附件文件,是否强制重新上传 , 默认false 更多...
 

详细描述

带有文件的附件类型的基类 描述文件的相关信息

在文件 FileAttachment.java19 行定义.

构造及析构函数说明

com.netease.nimlib.sdk.msg.attachment.FileAttachment.FileAttachment ( )

在文件 FileAttachment.java73 行定义.

com.netease.nimlib.sdk.msg.attachment.FileAttachment.FileAttachment ( String  attach)

在文件 FileAttachment.java77 行定义.

成员函数说明

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.getDisplayName ( )

获取文件的显示名。可以和文件名不同,仅用于界面展示

返回
文件显示名

在文件 FileAttachment.java278 行定义.

long com.netease.nimlib.sdk.msg.attachment.FileAttachment.getExpire ( )

在文件 FileAttachment.java313 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.getExtension ( )

获取文件后缀名

返回
后缀名

在文件 FileAttachment.java232 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.getFileName ( )

获取文件名。

返回

在文件 FileAttachment.java250 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.getMd5 ( )

获取文件内容MD5

返回
内容MD5

在文件 FileAttachment.java196 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.getNosTokenSceneKey ( )

获取文件上传时的nos scene

返回
nos scene

在文件 FileAttachment.java297 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.getPath ( )

获取文件本地路径,若文件不存在,返回null

返回
文件路径

在文件 FileAttachment.java86 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.getPathForSave ( )

获取用于保存该文件的位置

返回
文件路径

在文件 FileAttachment.java96 行定义.

long com.netease.nimlib.sdk.msg.attachment.FileAttachment.getSize ( )

获取文件大小,单位为byte

返回
文件大小

在文件 FileAttachment.java178 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.getThumbPath ( )

获取缩略图文件的本地路径,若文件不存在,返回null

返回
文件路径

在文件 FileAttachment.java109 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.getThumbPathForSave ( )

获取用于保存缩略图文件的位置

返回
文件路径

在文件 FileAttachment.java119 行定义.

Uri com.netease.nimlib.sdk.msg.attachment.FileAttachment.getUri ( )

在文件 FileAttachment.java163 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.getUrl ( )

获取文件在服务器上的下载url。若文件还未上传,返回null

返回
源站url

在文件 FileAttachment.java214 行定义.

boolean com.netease.nimlib.sdk.msg.attachment.FileAttachment.isForceUpload ( )

文件是否强制重新上传

返回
force upload

在文件 FileAttachment.java322 行定义.

void com.netease.nimlib.sdk.msg.attachment.FileAttachment.load ( JSONObject  json)
protected

在文件 FileAttachment.java343 行定义.

void com.netease.nimlib.sdk.msg.attachment.FileAttachment.save ( JSONObject  json)
protected

在文件 FileAttachment.java339 行定义.

void com.netease.nimlib.sdk.msg.attachment.FileAttachment.setDisplayName ( String  displayName)

设置文件显示名

参数
displayName文件显示名

在文件 FileAttachment.java287 行定义.

void com.netease.nimlib.sdk.msg.attachment.FileAttachment.setExtension ( String  extension)

设置文件后缀名

参数
extension后缀名

在文件 FileAttachment.java241 行定义.

void com.netease.nimlib.sdk.msg.attachment.FileAttachment.setForceUpload ( boolean  forceUpload)

设置文件是否强制重新上传,默认false

参数
forceUpload是否强制重新上传

在文件 FileAttachment.java331 行定义.

void com.netease.nimlib.sdk.msg.attachment.FileAttachment.setMd5 ( String  md5)

设置文件内容MD5

参数
md5内容MD5

在文件 FileAttachment.java205 行定义.

void com.netease.nimlib.sdk.msg.attachment.FileAttachment.setNosTokenSceneKey ( String  nosTokenSceneKey)

设置文件上传时的nos scene

参数
nosTokenSceneKey

在文件 FileAttachment.java306 行定义.

void com.netease.nimlib.sdk.msg.attachment.FileAttachment.setPath ( String  path)

设置文件路径

参数
path文件路径

在文件 FileAttachment.java136 行定义.

void com.netease.nimlib.sdk.msg.attachment.FileAttachment.setSize ( long  size)

设置文件大小,单位为byte

参数
size文件大小

在文件 FileAttachment.java187 行定义.

boolean com.netease.nimlib.sdk.msg.attachment.FileAttachment.setUri ( Uri  uri)

设置文件uri, 仅支持ContentResolver.SCHEME_FILE类型和ContentResolver.SCHEME_CONTENT类型的uri 仅支持发送消息时使用,接收的消息附件不支持uri

参数
uri
返回
false表示不支持的uri

在文件 FileAttachment.java148 行定义.

void com.netease.nimlib.sdk.msg.attachment.FileAttachment.setUrl ( String  url)

设置文件在服务器上的下载url

参数
url

在文件 FileAttachment.java223 行定义.

NimStorageType com.netease.nimlib.sdk.msg.attachment.FileAttachment.storageType ( )
protected

在文件 FileAttachment.java335 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.toJson ( boolean  send)

将消息附件序列化为字符串,存储到消息数据库或发送到服务器。

参数
send如果你的附件在本地需要存储额外数据,而这些数据不需要发送到服务器,可依据该参数值区别对待。
返回

实现了 com.netease.nimlib.sdk.msg.attachment.MsgAttachment.

在文件 FileAttachment.java360 行定义.

类成员变量说明

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.displayName
protected

文件显示名

在文件 FileAttachment.java47 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.extension
protected

文件后缀名

在文件 FileAttachment.java52 行定义.

boolean com.netease.nimlib.sdk.msg.attachment.FileAttachment.forceUpload = false
protected

如果服务器存在相同的附件文件,是否强制重新上传 , 默认false

在文件 FileAttachment.java67 行定义.

final String com.netease.nimlib.sdk.msg.attachment.FileAttachment.KEY_DOT = "."
static

在文件 FileAttachment.java22 行定义.

final String com.netease.nimlib.sdk.msg.attachment.FileAttachment.KEY_EXPIRE = "expire"
static

在文件 FileAttachment.java355 行定义.

final String com.netease.nimlib.sdk.msg.attachment.FileAttachment.KEY_EXT = "ext"
static

在文件 FileAttachment.java352 行定义.

final String com.netease.nimlib.sdk.msg.attachment.FileAttachment.KEY_FORCE_UPLOAD = "force_upload"
static

在文件 FileAttachment.java354 行定义.

final String com.netease.nimlib.sdk.msg.attachment.FileAttachment.KEY_MD5 = "md5"
static

在文件 FileAttachment.java350 行定义.

final String com.netease.nimlib.sdk.msg.attachment.FileAttachment.KEY_NAME = "name"
static

在文件 FileAttachment.java348 行定义.

final String com.netease.nimlib.sdk.msg.attachment.FileAttachment.KEY_PATH = "path"
static

在文件 FileAttachment.java347 行定义.

final String com.netease.nimlib.sdk.msg.attachment.FileAttachment.KEY_SCENE = "sen"
static

在文件 FileAttachment.java353 行定义.

final String com.netease.nimlib.sdk.msg.attachment.FileAttachment.KEY_SIZE = "size"
static

在文件 FileAttachment.java349 行定义.

final String com.netease.nimlib.sdk.msg.attachment.FileAttachment.KEY_URL = "url"
static

在文件 FileAttachment.java351 行定义.

final String com.netease.nimlib.sdk.msg.attachment.FileAttachment.KEY_V2_INTERNAL_UPLOAD_STATE = "KEY_V2_INTERNAL_UPLOAD_STATE"
static

在文件 FileAttachment.java357 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.md5
protected

文件内容的MD5

在文件 FileAttachment.java37 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.nosTokenSceneKey = NimNosSceneKeyConstant.NIM_DEFAULT_IM
protected

上传文件时用的对token对应的场景,默认NimNosSceneKeyConstant#NIM_DEFAULT_IM

在文件 FileAttachment.java62 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.path
protected

文件路径

在文件 FileAttachment.java27 行定义.

long com.netease.nimlib.sdk.msg.attachment.FileAttachment.size
protected

文件大小

在文件 FileAttachment.java32 行定义.

String com.netease.nimlib.sdk.msg.attachment.FileAttachment.url
protected

文件下载地址

在文件 FileAttachment.java42 行定义.


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