public class FileAttachment extends java.lang.Object implements MsgAttachment
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
displayName
File display name
|
protected java.lang.String |
extension
File extension
|
protected boolean |
forceUpload
If the same file already exists on the server, specify whether to upload forcibly.
|
protected java.lang.String |
md5
MD5 value of the file content
|
protected java.lang.String |
nosTokenSceneKey
NOS token used for uploading files.
|
protected java.lang.String |
path
File path
|
protected long |
size
File size
|
protected java.lang.String |
url
File download URL
|
Constructor and Description |
---|
FileAttachment() |
FileAttachment(java.lang.String attach) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDisplayName()
Get the display name of a file.
|
long |
getExpire() |
java.lang.String |
getExtension()
Get the file extension
|
java.lang.String |
getFileName()
Get the file name
|
java.lang.String |
getMd5()
Get the MD5 value of the file content
|
java.lang.String |
getNosTokenSceneKey()
Get the NOS token for uploading files
|
java.lang.String |
getPath()
Get the local file path.
|
java.lang.String |
getPathForSave()
Get the file path for save.
|
long |
getSize()
Get the size of a file in bytes
|
java.lang.String |
getThumbPath()
Get the local file path of the thumbnail.
|
java.lang.String |
getThumbPathForSave()
Get the path for saving thumbnails
|
java.lang.String |
getUrl()
Get the download URL of a file on the server.
|
boolean |
isForceUpload()
Check if the file are forcibly upload again
|
protected void |
load(JSONObject json) |
protected void |
save(JSONObject json) |
void |
setDisplayName(java.lang.String displayName)
Set the display name of a file
|
void |
setExtension(java.lang.String extension)
Set the file extension
|
void |
setForceUpload(boolean forceUpload)
Set to forcibly upload again.
|
void |
setMd5(java.lang.String md5)
Set the MD5 value of the file content
|
void |
setNosTokenSceneKey(java.lang.String nosTokenSceneKey)
Set the NOS token for uploading files
|
void |
setPath(java.lang.String path)
Set the file path
|
void |
setSize(long size)
Set the size of a file in bytes
|
void |
setUrl(java.lang.String url)
Set the download URL of a file stored on the server
|
protected NimStorageType |
storageType() |
java.lang.String |
toJson(boolean send)
Serialize message attachment to strings and store the strings in the message database or send them to the server.
|
protected java.lang.String path
protected long size
protected java.lang.String md5
protected java.lang.String url
protected java.lang.String displayName
protected java.lang.String extension
protected java.lang.String nosTokenSceneKey
NimNosSceneKeyConstant#NIM_DEFAULT_IM
protected boolean forceUpload
public FileAttachment()
public FileAttachment(java.lang.String attach)
public java.lang.String getPath()
public java.lang.String getPathForSave()
public java.lang.String getThumbPath()
public java.lang.String getThumbPathForSave()
public void setPath(java.lang.String path)
path
- The file pathpublic long getSize()
public void setSize(long size)
size
- The size of a filepublic java.lang.String getMd5()
public void setMd5(java.lang.String md5)
md5
- MD5 valuepublic java.lang.String getUrl()
public void setUrl(java.lang.String url)
url
- public java.lang.String getExtension()
public void setExtension(java.lang.String extension)
extension
- The file extensionpublic java.lang.String getFileName()
public java.lang.String getDisplayName()
public void setDisplayName(java.lang.String displayName)
displayName
- The display namepublic java.lang.String getNosTokenSceneKey()
public void setNosTokenSceneKey(java.lang.String nosTokenSceneKey)
nosTokenSceneKey
- public long getExpire()
public boolean isForceUpload()
public void setForceUpload(boolean forceUpload)
forceUpload
- Specify whether to forcibly upload againprotected NimStorageType storageType()
protected void save(JSONObject json)
protected void load(JSONObject json)
public java.lang.String toJson(boolean send)
MsgAttachment
toJson
in interface MsgAttachment
send
- If attachments are required to be stored in local storage and not to be sent to the server. The parameter can be specified.