<br><br><div class="gmail_quote">On Thu, Jun 9, 2011 at 10:43 PM, Chris Muller <span dir="ltr">&lt;<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">&gt; Ok. So if aStream is a fileStream for example, then the following two<br>
&gt; methods are correct:<br>
&gt;<br>
&gt;&gt;&gt; serialize: anObject on: aStream<br>
</div>&gt; ....<br>
<div class="im">&gt; and<br>
&gt;<br>
&gt;&gt;&gt; materializeFrom: aStream<br>
&gt;<br>
&gt;     | size classDefinitionsByteArray graphBufferByteArray |<br>
</div>&gt; ...<br>
&gt;<br>
&gt; is correct?<br>
<br>
Hmm, well, that might work, but you should just use the helper methods<br>
that are already provided for this, and which essentially do exactly<br>
the same thing.<br>
<br>
To serialize an object to a file, you may use<br>
MaObjectSerializer&gt;&gt;#fileOut:toFileNamed:in:, which calls<br>
MaObjectSerializer&gt;&gt;#object:toStream: (operates on any binary<br>
WriteStream).<br>
<br>
For materialization, use MaObjectSerializer class&gt;&gt;#fileIn:, which<br>
calls MaObjectSerializer class&gt;&gt;#objectFromStream: (operates on any<br>
binary ReadStream).  BTW, I just noticed these two methods are<br>
incorrectly categorized under &#39;debugging&#39;, they should be under their<br>
own category called &#39;file&#39; or something..<br></blockquote><div><br>Thanks Chris. In fact, those methods was the kind of thing I was looking for :)<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<br>
These are just convenience methods for saving / loading users work to<br>
a single file.  If you would need to load multiple files where<br>
performance is concerned, you would want to try to instantiate only<br>
one serializer and use it for all of them.<br></blockquote><div><br>I am not sure if I understood. In our benchmarks, we have a list of samples and each sample is at the same time an array of objects that we serialize/materialize. For each sample we create instantiate a serializer and a materializer.<br>
<br>I understood now that we should reuse the same serializer/materialize instance for all samples?  if true, why I don&#39;t use a Singleton ? I mean...it is not clear for me when to instantiate a serializer.<br clear="all">
 <br>Thanks Chris<br></div></div><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>