NSData+GNUstepBase documentation


Richard Frith-Macdonald (rfm@gnu.org)

Copyright: (C) 2003-2010 Free Software Foundation, Inc.

Software documentation for the NSData(GNUstepBase) category


Declared in:
Availability: Not in OpenStep/MacOS-X

Description forthcoming.
Method summary


- (NSString*) hexadecimalRepresentation;
Availability: Not in OpenStep/MacOS-X

Returns an NSString object containing an ASCII hexadecimal representation of the receiver. This means that the returned object will contain exactly twice as many characters as there are bytes as the receiver, as each byte in the receiver is represented by two hexadecimal digits.
The high order four bits of each byte is encoded before the low order four bits. Capital letters 'A' to 'F' are used to represent values from 10 to 15.
If you need the hexadecimal representation as raw byte data, use code like -
   hexData = [[sourceData hexadecimalRepresentation]
     dataUsingEncoding: NSASCIIStringEncoding];


- (id) initWithHexadecimalRepresentation: (NSString*)string;
Availability: Not in OpenStep/MacOS-X

Initialises the receiver with the supplied string data which contains a hexadecimal coding of the bytes. The parsing of the string is fairly tolerant, ignoring whitespace and permitting both upper and lower case hexadecimal digits (the -hexadecimalRepresentation method produces a string using only uppercase digits with no white space).
If the string does not contain one or more pairs of hexadecimal digits then an exception is raised.


- (NSData*) md5Digest;
Availability: Not in OpenStep/MacOS-X

Creates an MD5 digest of the information stored in the receiver and returns it as an autoreleased 16 byte NSData object.
If you need to produce a digest of string information, you need to decide what character encoding is to be used and convert your string to a data object of that encoding type first using the [NSString -dataUsingEncoding:] method -
   myDigest = [[myString dataUsingEncoding: NSUTF8StringEncoding] md5Digest];
If you need to use the digest in a human readable form, you will probably want it to be seen as 32 hexadecimal digits, and can do that using the -hexadecimalRepresentation method.

uudecodeInto: name: mode: 

- (BOOL) uudecodeInto: (NSMutableData*)decoded name: (NSString**)namePtr mode: (NSInteger*)modePtr;
Availability: Not in OpenStep/MacOS-X

Decodes the source data from uuencoded and return the result.
Returns the encoded file name in namePtr if it is not null. Returns the encoded file mode in modePtr if it is not null.

uuencodeInto: name: mode: 

- (BOOL) uuencodeInto: (NSMutableData*)encoded name: (NSString*)name mode: (NSInteger)mode;
Availability: Not in OpenStep/MacOS-X

Encode the source data to uuencoded.
Uses the supplied name as the filename in the encoded data, and says that the file mode is as specified.
If no name is supplied, uses untitled as the name.