{"action":"created","comment":{"url":"https://api.github.com/repos/leancloud/docs/pulls/comments/27092805","id":27092805,"diff_hunk":"@@ -337,59 +417,89 @@ conversation.sendMessage(message, new AVIMConversationCallback() {\n   @Override\n   public void done(AVException e) {\n     if (null != e) {\n-       // 出错了。。。\n+      // 出错了。。。\n+      e.printStackTrace();\n     } else {\n+      Logger.d(\"message sent.\");\n     }\n   }\n });\n ```\n \n-### 图像消息（AVIMImageMessage）\n-AVIMTypedMessage 子类，支持发送图像和附带文本的混合消息，其声明为：\n+### 文件消息（AVIMFileMessage）\n+AVIMTypedMessage 子类，用来发送带附件的消息，开发者可以用它来发送「离线文件」。对于此类消息，LeanCloud IM SDK 内部会先把文件上传到 LeanCloud 文件存储服务器（自带 CDN 功能），然后把文件元数据（url，文件大小等等）放在消息包内发送到 LeanCloud 实时通信服务端。其构造函数声明为：\n \n ```\n-public class AVIMImageMessage extends AVIMFileMessage {\n-  public AVIMImageMessage();\n-  public AVIMImageMessage(String localPath) throws FileNotFoundException, IOException;\n-  public AVIMImageMessage(File localFile) throws FileNotFoundException, IOException;\n-  public AVIMImageMessage(AVFile file);\n+// 传入本地文件路径，构造消息对象\n+public AVIMFileessage(String localPath) throws FileNotFoundException, IOException;\n+// 传入本地文件，构造消息对象\n+public AVIMFileMessage(File localFile) throws FileNotFoundException, IOException;\n+// 传入 AVFile 实例，构造消息对象\n+public AVIMFileMessage(AVFile file);\n+```\n \n-  /**\n-   * 获取文件的metaData\n-   *\n-   * @return\n-   */\n-  @Override\n-  public Map<String, Object> getFileMetaData();\n+与文本消息类似，文件消息也支持附带文本和其他自定义属性，可以通过如下方法添加 / 获取更多信息：\n \n-  /**\n-   * 获取图像的高\n-   * \n-   * @return\n-   */\n-  public int getHeight();\n+* String getText() / void setText(String text)\n+* Map<String, Object> getAttrs() / void setAttrs(Map<String, Object> attr);\n \n-  /**\n-   * 获取图像的宽度\n-   * \n-   * @return\n-   */\n-  public int getWidth();\n+发送文件消息的示例代码为：\n+\n+```\n+String localZipfilePath;\n+try {\n+  AVIMFileMessage message = new AVIMFileMessage(localZipfilePath);\n+  message.setText(\"这是你要的文档\");\n+  conversation.sendMessage(message, new AVIMConversationCallback() {\n+    @Override\n+    public void done(AVException e) {\n+      if (null != e) {\n+        // 出错了。。。\n+        e.printStackTrace();\n+      } else {\n+        Logger.d(\"message sent\");\n+      }\n+    }\n+  });\n+} catch (Exception ex) {\n }\n ```\n \n+接收到这样消息之后，开发者可以通过以下方法，获取到文件元数据（size 等）和一个包含图像数据的 AVFile 对象：","path":"md/android_realtime_v2.md","position":454,"original_position":454,"commit_id":"47ede870445cd75851008b17de111bb22e5886b6","original_commit_id":"47ede870445cd75851008b17de111bb22e5886b6","user":{"login":"jwfing","id":985038,"avatar_url":"https://avatars.githubusercontent.com/u/985038?v=3","gravatar_id":"","url":"https://api.github.com/users/jwfing","html_url":"https://github.com/jwfing","followers_url":"https://api.github.com/users/jwfing/followers","following_url":"https://api.github.com/users/jwfing/following{/other_user}","gists_url":"https://api.github.com/users/jwfing/gists{/gist_id}","starred_url":"https://api.github.com/users/jwfing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwfing/subscriptions","organizations_url":"https://api.github.com/users/jwfing/orgs","repos_url":"https://api.github.com/users/jwfing/repos","events_url":"https://api.github.com/users/jwfing/events{/privacy}","received_events_url":"https://api.github.com/users/jwfing/received_events","type":"User","site_admin":false},"body":"图像->二进制","created_at":"2015-03-25T03:26:48Z","updated_at":"2015-03-25T03:26:48Z","html_url":"https://github.com/leancloud/docs/pull/165#discussion_r27092805","pull_request_url":"https://api.github.com/repos/leancloud/docs/pulls/165","_links":{"self":{"href":"https://api.github.com/repos/leancloud/docs/pulls/comments/27092805"},"html":{"href":"https://github.com/leancloud/docs/pull/165#discussion_r27092805"},"pull_request":{"href":"https://api.github.com/repos/leancloud/docs/pulls/165"}}},"pull_request":{"url":"https://api.github.com/repos/leancloud/docs/pulls/165","id":31890318,"html_url":"https://github.com/leancloud/docs/pull/165","diff_url":"https://github.com/leancloud/docs/pull/165.diff","patch_url":"https://github.com/leancloud/docs/pull/165.patch","issue_url":"https://api.github.com/repos/leancloud/docs/issues/165","number":165,"state":"open","locked":false,"title":"add more sample code","user":{"login":"jwfing","id":985038,"avatar_url":"https://avatars.githubusercontent.com/u/985038?v=3","gravatar_id":"","url":"https://api.github.com/users/jwfing","html_url":"https://github.com/jwfing","followers_url":"https://api.github.com/users/jwfing/followers","following_url":"https://api.github.com/users/jwfing/following{/other_user}","gists_url":"https://api.github.com/users/jwfing/gists{/gist_id}","starred_url":"https://api.github.com/users/jwfing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwfing/subscriptions","organizations_url":"https://api.github.com/users/jwfing/orgs","repos_url":"https://api.github.com/users/jwfing/repos","events_url":"https://api.github.com/users/jwfing/events{/privacy}","received_events_url":"https://api.github.com/users/jwfing/received_events","type":"User","site_admin":false},"body":"@lzwjava @lbt05 @killme2008 ","created_at":"2015-03-25T03:20:08Z","updated_at":"2015-03-25T03:26:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"58d3e70e6a4f39f688ef7d74757316f2d480d375","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/leancloud/docs/pulls/165/commits","review_comments_url":"https://api.github.com/repos/leancloud/docs/pulls/165/comments","review_comment_url":"https://api.github.com/repos/leancloud/docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/leancloud/docs/issues/165/comments","statuses_url":"https://api.github.com/repos/leancloud/docs/statuses/47ede870445cd75851008b17de111bb22e5886b6","head":{"label":"jwfing:master","ref":"master","sha":"47ede870445cd75851008b17de111bb22e5886b6","user":{"login":"jwfing","id":985038,"avatar_url":"https://avatars.githubusercontent.com/u/985038?v=3","gravatar_id":"","url":"https://api.github.com/users/jwfing","html_url":"https://github.com/jwfing","followers_url":"https://api.github.com/users/jwfing/followers","following_url":"https://api.github.com/users/jwfing/following{/other_user}","gists_url":"https://api.github.com/users/jwfing/gists{/gist_id}","starred_url":"https://api.github.com/users/jwfing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwfing/subscriptions","organizations_url":"https://api.github.com/users/jwfing/orgs","repos_url":"https://api.github.com/users/jwfing/repos","events_url":"https://api.github.com/users/jwfing/events{/privacy}","received_events_url":"https://api.github.com/users/jwfing/received_events","type":"User","site_admin":false},"repo":{"id":29513312,"name":"docs","full_name":"jwfing/docs","owner":{"login":"jwfing","id":985038,"avatar_url":"https://avatars.githubusercontent.com/u/985038?v=3","gravatar_id":"","url":"https://api.github.com/users/jwfing","html_url":"https://github.com/jwfing","followers_url":"https://api.github.com/users/jwfing/followers","following_url":"https://api.github.com/users/jwfing/following{/other_user}","gists_url":"https://api.github.com/users/jwfing/gists{/gist_id}","starred_url":"https://api.github.com/users/jwfing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwfing/subscriptions","organizations_url":"https://api.github.com/users/jwfing/orgs","repos_url":"https://api.github.com/users/jwfing/repos","events_url":"https://api.github.com/users/jwfing/events{/privacy}","received_events_url":"https://api.github.com/users/jwfing/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jwfing/docs","description":"LeanCloud Documentation","fork":true,"url":"https://api.github.com/repos/jwfing/docs","forks_url":"https://api.github.com/repos/jwfing/docs/forks","keys_url":"https://api.github.com/repos/jwfing/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jwfing/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jwfing/docs/teams","hooks_url":"https://api.github.com/repos/jwfing/docs/hooks","issue_events_url":"https://api.github.com/repos/jwfing/docs/issues/events{/number}","events_url":"https://api.github.com/repos/jwfing/docs/events","assignees_url":"https://api.github.com/repos/jwfing/docs/assignees{/user}","branches_url":"https://api.github.com/repos/jwfing/docs/branches{/branch}","tags_url":"https://api.github.com/repos/jwfing/docs/tags","blobs_url":"https://api.github.com/repos/jwfing/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jwfing/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jwfing/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/jwfing/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jwfing/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/jwfing/docs/languages","stargazers_url":"https://api.github.com/repos/jwfing/docs/stargazers","contributors_url":"https://api.github.com/repos/jwfing/docs/contributors","subscribers_url":"https://api.github.com/repos/jwfing/docs/subscribers","subscription_url":"https://api.github.com/repos/jwfing/docs/subscription","commits_url":"https://api.github.com/repos/jwfing/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/jwfing/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/jwfing/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/jwfing/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/jwfing/docs/contents/{+path}","compare_url":"https://api.github.com/repos/jwfing/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jwfing/docs/merges","archive_url":"https://api.github.com/repos/jwfing/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jwfing/docs/downloads","issues_url":"https://api.github.com/repos/jwfing/docs/issues{/number}","pulls_url":"https://api.github.com/repos/jwfing/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/jwfing/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/jwfing/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jwfing/docs/labels{/name}","releases_url":"https://api.github.com/repos/jwfing/docs/releases{/id}","created_at":"2015-01-20T05:21:44Z","updated_at":"2015-03-25T03:18:59Z","pushed_at":"2015-03-25T03:18:54Z","git_url":"git://github.com/jwfing/docs.git","ssh_url":"git@github.com:jwfing/docs.git","clone_url":"https://github.com/jwfing/docs.git","svn_url":"https://github.com/jwfing/docs","homepage":"http://leancloud.cn/docs/","size":17986,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"leancloud:master","ref":"master","sha":"6402e9d966289e441093ce480b6f9906e2a0861e","user":{"login":"leancloud","id":6660518,"avatar_url":"https://avatars.githubusercontent.com/u/6660518?v=3","gravatar_id":"","url":"https://api.github.com/users/leancloud","html_url":"https://github.com/leancloud","followers_url":"https://api.github.com/users/leancloud/followers","following_url":"https://api.github.com/users/leancloud/following{/other_user}","gists_url":"https://api.github.com/users/leancloud/gists{/gist_id}","starred_url":"https://api.github.com/users/leancloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leancloud/subscriptions","organizations_url":"https://api.github.com/users/leancloud/orgs","repos_url":"https://api.github.com/users/leancloud/repos","events_url":"https://api.github.com/users/leancloud/events{/privacy}","received_events_url":"https://api.github.com/users/leancloud/received_events","type":"Organization","site_admin":false},"repo":{"id":25067518,"name":"docs","full_name":"leancloud/docs","owner":{"login":"leancloud","id":6660518,"avatar_url":"https://avatars.githubusercontent.com/u/6660518?v=3","gravatar_id":"","url":"https://api.github.com/users/leancloud","html_url":"https://github.com/leancloud","followers_url":"https://api.github.com/users/leancloud/followers","following_url":"https://api.github.com/users/leancloud/following{/other_user}","gists_url":"https://api.github.com/users/leancloud/gists{/gist_id}","starred_url":"https://api.github.com/users/leancloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leancloud/subscriptions","organizations_url":"https://api.github.com/users/leancloud/orgs","repos_url":"https://api.github.com/users/leancloud/repos","events_url":"https://api.github.com/users/leancloud/events{/privacy}","received_events_url":"https://api.github.com/users/leancloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/leancloud/docs","description":"LeanCloud Documentation","fork":false,"url":"https://api.github.com/repos/leancloud/docs","forks_url":"https://api.github.com/repos/leancloud/docs/forks","keys_url":"https://api.github.com/repos/leancloud/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leancloud/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leancloud/docs/teams","hooks_url":"https://api.github.com/repos/leancloud/docs/hooks","issue_events_url":"https://api.github.com/repos/leancloud/docs/issues/events{/number}","events_url":"https://api.github.com/repos/leancloud/docs/events","assignees_url":"https://api.github.com/repos/leancloud/docs/assignees{/user}","branches_url":"https://api.github.com/repos/leancloud/docs/branches{/branch}","tags_url":"https://api.github.com/repos/leancloud/docs/tags","blobs_url":"https://api.github.com/repos/leancloud/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leancloud/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leancloud/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/leancloud/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leancloud/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/leancloud/docs/languages","stargazers_url":"https://api.github.com/repos/leancloud/docs/stargazers","contributors_url":"https://api.github.com/repos/leancloud/docs/contributors","subscribers_url":"https://api.github.com/repos/leancloud/docs/subscribers","subscription_url":"https://api.github.com/repos/leancloud/docs/subscription","commits_url":"https://api.github.com/repos/leancloud/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/leancloud/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/leancloud/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/leancloud/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/leancloud/docs/contents/{+path}","compare_url":"https://api.github.com/repos/leancloud/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leancloud/docs/merges","archive_url":"https://api.github.com/repos/leancloud/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leancloud/docs/downloads","issues_url":"https://api.github.com/repos/leancloud/docs/issues{/number}","pulls_url":"https://api.github.com/repos/leancloud/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/leancloud/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/leancloud/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leancloud/docs/labels{/name}","releases_url":"https://api.github.com/repos/leancloud/docs/releases{/id}","created_at":"2014-10-11T07:14:37Z","updated_at":"2015-03-24T16:04:51Z","pushed_at":"2015-03-25T03:20:09Z","git_url":"git://github.com/leancloud/docs.git","ssh_url":"git@github.com:leancloud/docs.git","clone_url":"https://github.com/leancloud/docs.git","svn_url":"https://github.com/leancloud/docs","homepage":"http://leancloud.cn/docs/","size":20479,"stargazers_count":37,"watchers_count":37,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":16,"forks":35,"open_issues":16,"watchers":37,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/leancloud/docs/pulls/165"},"html":{"href":"https://github.com/leancloud/docs/pull/165"},"issue":{"href":"https://api.github.com/repos/leancloud/docs/issues/165"},"comments":{"href":"https://api.github.com/repos/leancloud/docs/issues/165/comments"},"review_comments":{"href":"https://api.github.com/repos/leancloud/docs/pulls/165/comments"},"review_comment":{"href":"https://api.github.com/repos/leancloud/docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/leancloud/docs/pulls/165/commits"},"statuses":{"href":"https://api.github.com/repos/leancloud/docs/statuses/47ede870445cd75851008b17de111bb22e5886b6"}}}}