Closed seandenigris closed 2 years ago
Thanks @seandenigris.
That comment isn't accurate anymore. I had planned it that way at one point but then changed the implementation. #fileName:
really takes the path to a file (as string), including extension.
You can either use fileName:
(which is just a convenience method) or pass a block to #streamFactory:
, which might give you the flexibility you need. For example:
string := String new: 3.
serializer := FLSerializer new
streamFactory: [ string writeStream ];
decorateStreamFactory: [ :stream | byteConverterStream on: stream ];
yourself.
If your stream is special (e.g. when you use a decorated stream as above), you might also have to override the default stream finalizer:
serializer streamFinalizer: [ :stream | stream doSomething; close ]
I will fix the comment in #fileName:
and maybe rename it to #filePathString:
since that is more accurate.
Ah, okay, I think fileName: will suffice now that I know I can set the extension there. Will give it a try...
Yes, it works. Do you want me to leave it open to bookmark the changes/explanation you proposed? Is the explanation in the docs already or should we add it somewhere?
Yes, leave it open. I haven't put any of the 4.0 changes into the docs yet.
In 4.1.0
Not sure what the canonical way to serialize/materialize is in v.4. I tried:
But got DNU
fileExtension:
in spite of the following:I should mention that I need to control the extension for SimplePersistence, which tracks versions via numbered extensions