<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -23,6 +23,14 @@ class Application
     @connection = NSURLConnection.connectionWithRequest(request, delegate: delegator)
   end
   
+  def connectionDidFinishLoading(connection)
+    @status.text  = &quot;Data totally retrieved&quot;
+    page          = NSString.alloc.initWithData(@receivedData, encoding:NSUTF8StringEncoding)
+    @receivedData = nil
+    @data.text    = page
+    NSLog(&quot;data fully received&quot;)
+  end
+  
   # Deal with the data response
   # 
   # Note: in Ruby, the method name is the method signature
@@ -34,10 +42,11 @@ class Application
   end
   
   def connection(connection, didReceiveData:receivedData)
-    @status.text  = &quot;Data retrieved&quot;
-    page          = NSString.alloc.initWithData(receivedData, encoding:NSUTF8StringEncoding)
-    NSLog(page)
-    @data.text    = page
+    @status.text  = &quot;Data being retrieved&quot;
+    # Initiate an ivar to store the received data
+    @receivedData ||= NSMutableData.new
+    @receivedData.appendData(receivedData)
+    NSLog(&quot;data chunck received&quot;)
   end
 end
 </diff>
      <filename>download/lib/application.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5bbe973c5f23431f55ec72ad5a79830794d59294</id>
    </parent>
  </parents>
  <author>
    <name>Matt Aimonetti</name>
    <email>mattaimonetti@gmail.com</email>
  </author>
  <url>http://github.com/drnic/macruby-examples/commit/eb3658c29030846d9ffbe9f44e97619597f04d7e</url>
  <id>eb3658c29030846d9ffbe9f44e97619597f04d7e</id>
  <committed-date>2008-12-29T20:12:57-08:00</committed-date>
  <authored-date>2008-12-29T20:09:12-08:00</authored-date>
  <message>improved the example showing how to check that a file is fully downloaded before processing it

Signed-off-by: Dr Nic Williams &lt;drnicwilliams@gmail.com&gt;</message>
  <tree>e166d1aee5651bd97dfd09e728a1a38c110672dd</tree>
  <committer>
    <name>Dr Nic Williams</name>
    <email>drnicwilliams@gmail.com</email>
  </committer>
</commit>
