Rewrite of NSData from Richard Frith-Macdonald <richard@brainstorm.co.uk>

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2459 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 1997-09-29 14:39:53 +00:00
parent 7b704b0ec4
commit f88a65db7e
32 changed files with 1576 additions and 2603 deletions

View file

@ -252,20 +252,16 @@ static BOOL debug_coder = NO;
/* Initializing an archiver */
@interface NSData (Streaming) <Streaming>
@end
- (id) initForWritingWithMutableData: (NSMutableData*)mdata
{
/* This relies on the fact that GNU extentions to NSMutableData
cause it to conform to <Streaming>. */
[(id)self initForWritingToStream: mdata];
[(id)self initForWritingToStream: [MemoryStream streamWithData: mdata]];
return self;
}
- (id) initForReadingWithData: (NSData*)data
{
id ret = [[self class] newReadingFromStream: data];
id ret = [[self class] newReadingFromStream:
[MemoryStream streamWithData:data]];
if ([self retainCount] == 0)
[ret autorelease];
else
@ -295,7 +291,8 @@ static BOOL debug_coder = NO;
+ unarchiveObjectWithData: (NSData*) data
{
return [self decodeObjectWithName: NULL fromStream: data];
return [self decodeObjectWithName: NULL
fromStream: [MemoryStream streamWithData:data]];
}
+ unarchiveObjectWithFile: (NSString*) path