<br><br><div class="gmail_quote">On Thu, Jun 9, 2011 at 10:43 PM, Chris Muller <span dir="ltr"><<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> Ok. So if aStream is a fileStream for example, then the following two<br>
> methods are correct:<br>
><br>
>>> serialize: anObject on: aStream<br>
</div>> ....<br>
<div class="im">> and<br>
><br>
>>> materializeFrom: aStream<br>
><br>
> | size classDefinitionsByteArray graphBufferByteArray |<br>
</div>> ...<br>
><br>
> 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>>#fileOut:toFileNamed:in:, which calls<br>
MaObjectSerializer>>#object:toStream: (operates on any binary<br>
WriteStream).<br>
<br>
For materialization, use MaObjectSerializer class>>#fileIn:, which<br>
calls MaObjectSerializer class>>#objectFromStream: (operates on any<br>
binary ReadStream). BTW, I just noticed these two methods are<br>
incorrectly categorized under 'debugging', they should be under their<br>
own category called 'file' 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'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>