@@ -598,10 +598,26 @@ } @finally { [file release]; } } #endif + +- (void)writeToURL: (OFURL *)URL +{ + void *pool = objc_autoreleasePoolPush(); + OFURLHandler *URLHandler; + OFStream *stream; + + if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) + @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; + + stream = [URLHandler openItemAtURL: URL + mode: @"w"]; + [stream writeData: self]; + + objc_autoreleasePoolPop(pool); +} - (OFXMLElement *)XMLElementBySerializing { void *pool; OFXMLElement *element;