@@ -17,21 +17,52 @@ #include "config.h" #import "OFSeekFailedException.h" #import "OFString.h" +#import "OFNotImplementedException.h" + #import "common.h" @implementation OFSeekFailedException ++ newWithClass: (Class)class_ + stream: (OFSeekableStream*)stream +{ + return [[self alloc] initWithClass: class_ + stream: stream]; +} + +- initWithClass: (Class)class_ +{ + Class c = isa; + [self release]; + @throw [OFNotImplementedException newWithClass: c + selector: _cmd]; +} + - initWithClass: (Class)class_ + stream: (OFSeekableStream*)stream_ { self = [super initWithClass: class_]; - errNo = GET_ERRNO; + @try { + stream = [stream_ retain]; + errNo = GET_ERRNO; + } @catch (id e) { + [self release]; + @throw e; + } return self; } + +- (void)dealloc +{ + [stream release]; + + [super dealloc]; +} - (OFString*)description { if (description != nil) return description; @@ -39,11 +70,16 @@ description = [[OFString alloc] initWithFormat: @"Seeking failed in class %@! " ERRFMT, inClass, ERRPARAM]; return description; } + +- (OFSeekableStream*)stream +{ + return stream; +} - (int)errNo { return errNo; } @end