NIMSDK-AOS  9.16.0
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)
 将消息附件序列化为字符串,存储到消息数据库或发送到服务器。
更多...
 

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.java20 行定义.

构造及析构函数说明

◆ FileAttachment() [1/2]

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

在文件 FileAttachment.java71 行定义.

◆ FileAttachment() [2/2]

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

在文件 FileAttachment.java75 行定义.

成员函数说明

◆ getDisplayName()

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

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

返回
文件显示名

在文件 FileAttachment.java269 行定义.

◆ getExpire()

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

在文件 FileAttachment.java304 行定义.

◆ getExtension()

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

获取文件后缀名

返回
后缀名

在文件 FileAttachment.java230 行定义.

◆ getFileName()

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

获取文件名。

返回

在文件 FileAttachment.java248 行定义.

◆ getMd5()

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

获取文件内容MD5

返回
内容MD5

在文件 FileAttachment.java194 行定义.

◆ getNosTokenSceneKey()

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

获取文件上传时的nos scene

返回
nos scene

在文件 FileAttachment.java288 行定义.

◆ getPath()

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

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

返回
文件路径

在文件 FileAttachment.java84 行定义.

◆ getPathForSave()

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

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

返回
文件路径

在文件 FileAttachment.java94 行定义.

◆ getSize()

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

获取文件大小,单位为byte

返回
文件大小

在文件 FileAttachment.java176 行定义.

◆ getThumbPath()

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

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

返回
文件路径

在文件 FileAttachment.java107 行定义.

◆ getThumbPathForSave()

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

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

返回
文件路径

在文件 FileAttachment.java117 行定义.

◆ getUri()

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

在文件 FileAttachment.java161 行定义.

◆ getUrl()

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

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

返回
源站url

在文件 FileAttachment.java212 行定义.

◆ isForceUpload()

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

文件是否强制重新上传

返回
force upload

在文件 FileAttachment.java313 行定义.

◆ load()

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

在文件 FileAttachment.java334 行定义.

◆ save()

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

在文件 FileAttachment.java330 行定义.

◆ setDisplayName()

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

设置文件显示名

参数
displayName文件显示名

在文件 FileAttachment.java278 行定义.

◆ setExtension()

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

设置文件后缀名

参数
extension后缀名

在文件 FileAttachment.java239 行定义.

◆ setForceUpload()

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

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

参数
forceUpload是否强制重新上传

在文件 FileAttachment.java322 行定义.

◆ setMd5()

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

设置文件内容MD5

参数
md5内容MD5

在文件 FileAttachment.java203 行定义.

◆ setNosTokenSceneKey()

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

设置文件上传时的nos scene

参数
nosTokenSceneKey

在文件 FileAttachment.java297 行定义.

◆ setPath()

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

设置文件路径

参数
path文件路径

在文件 FileAttachment.java134 行定义.

◆ setSize()

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

设置文件大小,单位为byte

参数
size文件大小

在文件 FileAttachment.java185 行定义.

◆ setUri()

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

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

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

在文件 FileAttachment.java146 行定义.

◆ setUrl()

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

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

参数
url

在文件 FileAttachment.java221 行定义.

◆ storageType()

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

在文件 FileAttachment.java326 行定义.

◆ toJson()

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

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

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

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

在文件 FileAttachment.java350 行定义.

类成员变量说明

◆ displayName

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

文件显示名

在文件 FileAttachment.java45 行定义.

◆ extension

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

文件后缀名

在文件 FileAttachment.java50 行定义.

◆ forceUpload

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

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

在文件 FileAttachment.java65 行定义.

◆ md5

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

文件内容的MD5

在文件 FileAttachment.java35 行定义.

◆ nosTokenSceneKey

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

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

在文件 FileAttachment.java60 行定义.

◆ path

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

文件路径

在文件 FileAttachment.java25 行定义.

◆ size

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

文件大小

在文件 FileAttachment.java30 行定义.

◆ url

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

文件下载地址

在文件 FileAttachment.java40 行定义.


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