#1380 Close InStream after readObj

Akcelisto Tue 11 Jan 2011

I want:

Box box := file.in.readObj

but:

in := file.in
Box box := in.readObj
in.close

I want that readObj closes InStream. There is somebody who store more then one obj in File?

Altrough, this is not available because This method may consume bytes/chars past the end of the serialized object.

brian Tue 11 Jan 2011

Since the object deserialized uses a fairly complicated tokenizer/parser under the covers, there is no guarantee that it hasn't read chars past the end of the stream. If you need to store more one than object, you need to ensure there is some clean object separator you can tokenize the stream into chunks.

Akcelisto Tue 11 Jan 2011

I not clearly explain. I not want save few objects. I want: method readObj closes stream. So I can deserialize objs in one line.

brian Tue 11 Jan 2011

I am not following that. If you want to an readObj out from a file in one line and have the stream automatically closed use sys::File.readObj - is that what you are asking for?

Akcelisto Tue 11 Jan 2011

Yes. This is that I asking.

Login or Signup to reply.