diff --git a/Source/Coder.m b/Source/Coder.m index 5eaa6325e..0fdfc971c 100644 --- a/Source/Coder.m +++ b/Source/Coder.m @@ -225,6 +225,13 @@ my_object_is_class(id object) formatVersion: DEFAULT_FORMAT_VERSION]; } +- initForReadingFromFile: (id ) filename +{ + return [self initForReadingFromStream: + [StdioStream streamWithFilename: filename + fmode: "r"]]; +} + - initForWritingToStream: (id ) s formatVersion: (int) version { @@ -242,6 +249,13 @@ my_object_is_class(id object) formatVersion: DEFAULT_FORMAT_VERSION]; } +- initForWritingToFile: (id ) filename +{ + return [self initForWritingToStream: + [StdioStream streamWithFilename: filename + fmode: "w"]]; +} + + coderWritingToStream: (id )s { return [[[self alloc] initForWritingToStream: s] @@ -1158,6 +1172,18 @@ exc_return_null(arglist_t f) } } +/* We must separate the idea of "closing" a coder and "deallocating" + a coder because of delays in deallocation due to -autorelease. */ +- (void) closeCoder +{ + [[cstream stream] closeStream]; +} + +- (BOOL) isClosed +{ + return [[cstream stream] isClosed]; +} + - (void) dealloc { /* xxx No. [self _finishDecodeRootObject]; */