<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 19, 2016, at 12:58 AM, Quinn The Eskimo! via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">The reason I ask is that most of the time when I mess around with files I transfer the entire file to and from memory, which is something that the Foundation APIs excel at.</span><br style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote></div><br class=""><div class="">I believe Mac/iOS developers usually transfer the entire file <i class="">because</i> that’s the particular hammer that Foundation provides. For some reason Foundation has never had good stream APIs (and they used to be worse!), so it’s much more convenient to just use NSData or NSString methods to read and write the entire file, than it is to mess around with NSFileHandle or NSStream.</div><div class=""><br class=""></div><div class="">Conversely, most other platforms (certainly C/POSIX and Java) make it easier to stream the file (which I believe is more efficient; certainly more scalable) than to block-read/write it.</div><div class=""><br class=""></div><div class="">I’m hoping that the Swift translation of Foundation provides greatly-improved Stream classes.</div><div class=""><br class=""></div><div class="">—Jens</div></body></html>