{"action":"created","issue":{"url":"https://api.github.com/repos/westlinkin/CacheUtilsLibrary/issues/3","repository_url":"https://api.github.com/repos/westlinkin/CacheUtilsLibrary","labels_url":"https://api.github.com/repos/westlinkin/CacheUtilsLibrary/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/westlinkin/CacheUtilsLibrary/issues/3/comments","events_url":"https://api.github.com/repos/westlinkin/CacheUtilsLibrary/issues/3/events","html_url":"https://github.com/westlinkin/CacheUtilsLibrary/issues/3","id":138770819,"number":3,"title":"Data already written is cleared from cache with new write request ","user":{"login":"Ruchita7","id":15085932,"avatar_url":"https://avatars.githubusercontent.com/u/15085932?v=3","gravatar_id":"","url":"https://api.github.com/users/Ruchita7","html_url":"https://github.com/Ruchita7","followers_url":"https://api.github.com/users/Ruchita7/followers","following_url":"https://api.github.com/users/Ruchita7/following{/other_user}","gists_url":"https://api.github.com/users/Ruchita7/gists{/gist_id}","starred_url":"https://api.github.com/users/Ruchita7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ruchita7/subscriptions","organizations_url":"https://api.github.com/users/Ruchita7/orgs","repos_url":"https://api.github.com/users/Ruchita7/repos","events_url":"https://api.github.com/users/Ruchita7/events{/privacy}","received_events_url":"https://api.github.com/users/Ruchita7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-06T08:58:30Z","updated_at":"2016-05-03T05:59:53Z","closed_at":null,"body":"In the sample code, since we are saving the data in utf-8 format to a cache file in the device storage, every time a new write request is made, the existing written data is flushed out.\r\n\r\nTo solve this I appended the content of the file using the FileOutputStream(String path, boolean append) constructor like this  :\r\n            IOUtils.write(fileContent, new FileOutputStream(pathForCacheEntry(fileName),true), ENCODING);\r\n\r\nBut with this approach the buildGson from JSON for MyClass and Map<String<T>> data types do not work as the data is not in valid JSON format."},"comment":{"url":"https://api.github.com/repos/westlinkin/CacheUtilsLibrary/issues/comments/216445260","html_url":"https://github.com/westlinkin/CacheUtilsLibrary/issues/3#issuecomment-216445260","issue_url":"https://api.github.com/repos/westlinkin/CacheUtilsLibrary/issues/3","id":216445260,"user":{"login":"westlinkin","id":1687198,"avatar_url":"https://avatars.githubusercontent.com/u/1687198?v=3","gravatar_id":"","url":"https://api.github.com/users/westlinkin","html_url":"https://github.com/westlinkin","followers_url":"https://api.github.com/users/westlinkin/followers","following_url":"https://api.github.com/users/westlinkin/following{/other_user}","gists_url":"https://api.github.com/users/westlinkin/gists{/gist_id}","starred_url":"https://api.github.com/users/westlinkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/westlinkin/subscriptions","organizations_url":"https://api.github.com/users/westlinkin/orgs","repos_url":"https://api.github.com/users/westlinkin/repos","events_url":"https://api.github.com/users/westlinkin/events{/privacy}","received_events_url":"https://api.github.com/users/westlinkin/received_events","type":"User","site_admin":false},"created_at":"2016-05-03T05:59:53Z","updated_at":"2016-05-03T05:59:53Z","body":"It is intended to flush out the existing written data. To cache data (java object instance) into device, if it uses the same file name, it is meant to be over-write. There is no append-write feature for now."}}