[Glass] GsFile atEnd answering nil rather than boolean

Mariano Martinez Peck via Glass glass at lists.gemtalksystems.com
Wed Mar 4 05:13:24 PST 2015


What is funny is that there is a class called BinaryOrTextFile which I have
no clue what it is (no class comment and doesn't appear in guides either),
but it's a subclass of GsFile and implements:

atEnd

| ans |
(ans := super atEnd) == nil ifTrue: [ ^true ].
^ans


So...it is assuming that GsFile atEnd answering nil is like true.... while
superclass (GsFile) #atEnd method comment  says the primitive answers nil
upon error.

Best,



On Wed, Mar 4, 2015 at 10:08 AM, Mariano Martinez Peck <
marianopeck at gmail.com> wrote:

> Hi guys,
>
> I am trying to import a large SIXX file (46MB) using an approach like the
> following:
>
> | codec stream object context persistentKey persistentDict |
> persistentKey := ('SIXX_ROOT_ARRAY', Object new identityHash asString)
> asSymbol.
> persistentDict := UserGlobals at: #LargeSIXXExportsAndImportRoots.
> stream := (FileStream oldFileNamed: aFilename) text.
> [
> MCPlatformSupport commitOnAlmostOutOfMemoryDuring: [
>    persistentDict at: persistentKey put: Array new.
> context := SixxContext forRead.
> FACompatibilityUtils current addSixxShapeChargers: context classResolver.
> object := Object readSixxFrom: stream
>       context: context
> persistentRoot: (persistentDict at: persistentKey)
> ].
> ] ensure: [ persistentDict removeKey: persistentKey ].
> ^ object
>
> *The problem is that I get a Sixx parse error because at some point GsFile
> answers nil to #atEnd.* The method says that that happens when there is
> an error. But I have no idea what error can be. I tried to send
> #lastErrorString to the GsFile instance but I also get nil.
>
> Any clues on when #atEnd can answer nil or how can I get more info of why
> it is failing?
>
> Thanks in advance,
>
>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150304/aa55943c/attachment.html>


More information about the Glass mailing list