From 2047caaf476c87e5a9c687fd9c716e8731a8e1ee Mon Sep 17 00:00:00 2001 From: mccallum Date: Thu, 25 Jan 1996 15:27:30 +0000 Subject: [PATCH] ([Coder -initForReadingFromFile:filename]): New method. ([Coder -initForWritingToFile:filename]): New method. ([Coder -closeCoder]): New method. ([Coder -isClosed]): New method. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@814 72102866-910b-0410-8b05-ffd578937521 --- Source/Coder.m | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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]; */