{"id":13078,"date":"2015-12-11T14:56:30","date_gmt":"2015-12-11T19:56:30","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=13078"},"modified":"2015-12-11T14:56:30","modified_gmt":"2015-12-11T19:56:30","slug":"nsfilehandles-indeterminable-readabilityhandler","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/12\/11\/nsfilehandles-indeterminable-readabilityhandler\/","title":{"rendered":"NSFileHandle&rsquo;s Indeterminable readabilityHandler"},"content":{"rendered":"<p><a href=\"http:\/\/stackoverflow.com\/questions\/15851391\/how-to-check-for-end-of-file-using-nsfilehandles-readabilityhandler\">Sven<\/a> (via <a href=\"https:\/\/alpha.app.net\/jws\/post\/66472795\">Jeremy W. Sherman<\/a>):<\/p>\n<blockquote cite=\"http:\/\/stackoverflow.com\/questions\/15851391\/how-to-check-for-end-of-file-using-nsfilehandles-readabilityhandler\"><p>The problem is that I need to know when the last chunk of data was read. <code>availableData<\/code> should return an empty <code>NSData<\/code> instance if it reached end-of-file, but the problem is that the reachability handler is not called again on EOF.<\/p>\n<p>I can&rsquo;t find anything about how to get some kind of notification or callback on EOF. So what am I missing? Is Apple really providing an asynchronous reading API without an EOF callback?<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Sven (via Jeremy W. Sherman): The problem is that I need to know when the last chunk of data was read. availableData should return an empty NSData instance if it reached end-of-file, but the problem is that the reachability handler is not called again on EOF. I can&rsquo;t find anything about how to get some [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,880,31,30,71],"class_list":["post-13078","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-grand-central-dispatch-gcd","tag-ios","tag-mac","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/13078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=13078"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/13078\/revisions"}],"predecessor-version":[{"id":13079,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/13078\/revisions\/13079"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=13078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=13078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=13078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}