Classes
Protocols
Constants
Functions
Macros
Types
Variables

### Classes

GCArray
GCDictionary
GCMutableArray
GCMutableDictionary
GCObject
GSHTMLParser
GSHTMLSAXHandler
GSMimeCodingContext
GSMimeDocument
GSMimeHeader
GSMimeParser
GSMimeSMTPClient
GSMimeSerializer
GSSAXHandler
GSTLSCertificateList
GSTLSCredentials
GSTLSDHParams
GSTLSObject
GSTLSPrivateKey
GSTLSSession
GSTreeSAXHandler
GSXMLAttribute
GSXMLDocument
GSXMLNamespace
GSXMLNode
GSXMLParser
GSXMLRPC
GSXPathBoolean
GSXPathContext
GSXPathNodeSet
GSXPathNumber
GSXPathObject
GSXPathString

### Protocols

### Constants

GSMimeErrorDomain
GSTLSCAFile
GSTLSCertificateFile
GSTLSCertificateKeyFile
GSTLSCertificateKeyPassword
GSTLSDebug
GSTLSIssuers
GSTLSOwners
GSTLSPriority
GSTLSRemoteHosts
GSTLSRevokeFile
GSTLSServerName
GSTLSVerify

### Functions

GSAutoreleasedBuffer
GSCGetInstanceVariableDefinition
GSClassFromName
GSClassList
GSClassNameFromObject
GSClassSwizzle
GSCurrentThread
GSCurrentThreadDictionary
GSDebugFunctionMsg
GSDebugMethodMsg
GSDebugSet
GSDefaultLanguageLocale
GSDomainFromDefaultLocale
GSEncodingForRegistry
GSEncodingFromLocale
GSFindNamedFile
GSFlushMethodCacheForClass
GSFromUnicode
GSGetMethod
GSIArrayAddItem
GSIArrayAddItemNoRetain
GSIArrayCapacity
GSIArrayCheckSort
GSIArrayClear
GSIArrayCopyWithZone
GSIArrayCount
GSIArrayEmpty
GSIArrayGrow
GSIArrayGrowTo
GSIArrayInitWithZoneAndCapacity
GSIArrayInitWithZoneAndStaticCapacity
GSIArrayInsertItem
GSIArrayInsertItemNoRetain
GSIArrayInsertSorted
GSIArrayInsertSortedNoRetain
GSIArrayInsertionPosition
GSIArrayItemAtIndex
GSIArrayItems
GSIArrayLastItem
GSIArrayRemoveAllItems
GSIArrayRemoveItemAtIndex
GSIArrayRemoveItemAtIndexNoRelease
GSIArrayRemoveItemsFromIndex
GSIArrayRemoveLastItem
GSIArraySearch
GSIArraySetItemAtIndex
GSIArraySize
GSIMapAddKey
GSIMapAddKeyNoRetain
GSIMapAddNodeToBucket
GSIMapAddNodeToMap
GSIMapAddPair
GSIMapAddPairNoRetain
GSIMapBucketForKey
GSIMapCleanMap
GSIMapCountByEnumeratingWithStateObjectsCount
GSIMapEmptyMap
GSIMapEndEnumerator
GSIMapEnumeratorBucket
GSIMapEnumeratorForMap
GSIMapEnumeratorNextNode
GSIMapFirstNode
GSIMapFreeNode
GSIMapGetNode
GSIMapInitWithZoneAndCapacity
GSIMapLinkNodeIntoBucket
GSIMapMoreNodes
GSIMapNodeForKey
GSIMapNodeForKeyInBucket
GSIMapNodeForSimpleKey
GSIMapPickBucket
GSIMapRemangleBuckets
GSIMapRemoveAndFreeNode
GSIMapRemoveKey
GSIMapRemoveNodeFromBucket
GSIMapRemoveNodeFromMap
GSIMapRemoveWeak
GSIMapResize
GSIMapRightSizeMap
GSIMapSize
GSIMapUnlinkNodeFromBucket
GSLanguageFromLocale
GSLanguagesFromLocale
GSLastErrorStr
GSLocaleVariants
GSNameFromClass
GSNameFromSelector
GSObjCAddClassBehavior
GSObjCAddClassOverride
GSObjCAddClasses
GSObjCAddMethods
GSObjCAllSubclassesOfClass
GSObjCBehaviorDebug
GSObjCClass
GSObjCDirectSubclassesOfClass
GSObjCFindVariable
GSObjCGetInstanceVariableDefinition
GSObjCGetVal
GSObjCGetVariable
GSObjCIsClass
GSObjCIsInstance
GSObjCIsKindOf
GSObjCMakeClass
GSObjCMethodNames
GSObjCSetVal
GSObjCSetVariable
GSObjCSuper
GSObjCVariableNames
GSObjCVersion
GSPathHandling
GSPrintf
GSProtocolFromName
GSProtocolGetMethodDescriptionRecursive
GSRegisterProtocol
GSSelectorFromName
GSSelectorFromNameAndTypes
GSSelectorTypesMatch
GSSetLocale
GSSetLocaleC
GSSkipTypeQualifierAndLayoutInfo
GSToUnicode
GSTypesFromSelector
GSUnicode
_Block_copy
_Block_release
gs_consumed
objc_copyWeak
objc_destroyWeak
objc_initWeak
objc_loadWeak
objc_loadWeakRetained
objc_moveWeak
objc_storeWeak
uni_cop
uni_is_decomp
uni_isnonsp
uni_tolower
uni_toupper

### Macros

ALog
ASSIGN
ASSIGNCOPY
ASSIGNMUTABLECOPY
AUTORELEASE
BLOCK_SCOPE
CALL_BLOCK
CALL_BLOCK_NO_ARGS
CALL_BLOCK_RET
CALL_BLOCK_RET_NO_ARGS
CALL_NON_NULL_BLOCK
CALL_NON_NULL_BLOCK_NO_ARGS
CHECK_INDEX_RANGE_ERROR
CREATE_AUTORELEASE_POOL
DEALLOC
DEFINE_BLOCK_TYPE
DEFINE_BLOCK_TYPE_NO_ARGS
DESTROY
DLog
ENTER_POOL
GSLocalizedStaticString
GSOnceFLog
GSOnceMLog
GS_API_LATEST
GS_API_MACOSX
GS_API_NONE
GS_API_OPENSTEP
GS_API_OSSPEC
GS_API_VERSION
GS_CLANG_MINREQ
GS_DEPRECATED_FUNC
GS_EXPOSE
GS_GCC_MINREQ
GS_LOCALISATION_BUNDLE
GS_MAX_OBJECTS_FROM_STACK
GS_NORETURN_METHOD
GS_PART_MAP_ENUMERATOR
GS_RANGE_CHECK
GS_UNIMPLEMENTED
GS_UNUSED_ARG
GS_UNUSED_FUNC
GS_UNUSED_IVAR
GS_USEIDLIST
GS_USEIDPAIRLIST
IF_NO_ARC
IF_NO_GC
LEAVE_POOL
MAC_OS_X_VERSION_MAX_ALLOWED
NSDebugFLLog
NSDebugFLog
NSDebugFRLog
NSDebugLLog
NSDebugLog
NSDebugMLLog
NSDebugMLog
NSDebugMRLog
NSWarnFLog
NSWarnLog
NSWarnMLog
NS_CONSUMED
NS_CONSUMES_SELF
NS_RETURNS_NOT_RETAINED
NS_RETURNS_RETAINED
OS_API_VERSION
RECREATE_AUTORELEASE_POOL
RELEASE
RETAIN
TEST_AUTORELEASE
TEST_RELEASE
TEST_RETAIN
_
__
__has_feature

### Types

GSIArray
GSIArray_t
GSIMapBucket
GSIMapBucket_t
GSIMapEnumerator
GSIMapEnumerator_t
GSIMapNode
GSIMapNode_t
GSIMapTable
GSIMapTable_t
GSIVar
GSMethod
GSMimeErrorCode
GSTLSIOR
GSTLSIOW
NSGNUstepStringEncoding
NSInteger
NSUInteger
struct _GSIMapEnumerator

### Variables

_GSIE
struct _GSIArray
struct _GSIMapBucket
struct _GSIMapNode
struct _GSIMapTable

Up

# NSData+GNUstepBase documentation

### Authors

Richard Frith-Macdonald (`rfm@gnu.org`)

Date: Generated at 2025-09-10 09:16:48 +0000

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

# Software documentation for the NSData(GNUstepBase) category

## NSData(GNUstepBase)

> Declared in:
>   GNUstepBase/NSData+GNUstepBase.h

Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### Method summary

- +dataWithRandomBytesOfLength:
- -escapedRepresentation
- -escapedRepresentation:
- -gunzipped
- -gzipped:
- -hexadecimalRepresentation
- -hexadecimalRepresentation:
- -initWithHexadecimalRepresentation:
- -isGzipped
- -md5Digest
- -uudecodeInto:name:mode:
- -uuencodeInto:name:mode:

### dataWithRandomBytesOfLength:

+ (id) dataWithRandomBytesOfLength: (NSUInteger)length;
Availability: Not in OpenStep/MacOS-X
Returns an autoreleased data instance initialised with pseudo-random bytes of the specified length.
On failure returns `nil`. This may be due to:
A zero length or unreasonably large length argument or,
Failure to allocate memory to hold the random data or,
Failure of the underlying random data generation.

### escapedRepresentation

- (NSString*) escapedRepresentation;
Availability: Not in OpenStep/MacOS-X
Returns an NSString object containing a backslash escaped representation of the receiver.

### escapedRepresentation:

- (char*) escapedRepresentation: (NSUInteger*)length;
Availability: Not in OpenStep/MacOS-X
Returns a buffer containing an ASCII backslash escaped representation of the receiver, (and optionally the size of the buffer excluding the trailing nul terminator).

### gunzipped

- (NSData*) gunzipped;
Availability: Not in OpenStep/MacOS-X
Returns data formed by gunzipping the contents of the receiver.
If the receiver did not contain data produced by gzip, this method simply returns the receiver.
If the gnuzipping failed, this method returns `nil`.
Otherwise, the returned object is an autorelease mutable data object.

### gzipped:

- (NSData*) gzipped: (int)level;
Availability: Not in OpenStep/MacOS-X
Returns data formed by gzipping the contents of the receiver using the specified compression level (from 0 to 9 with 0 meaning no compression and 9 meaning maximum compression). Use a value outside the 0 to 9 range (eg -1) to employ the default compression.
NB. It is permissable to gzip an empty data object, and it is also permissable to gzip a data object which already contains gzipped data.
Returns `nil` on failure.

### hexadecimalRepresentation

- (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.

### hexadecimalRepresentation:

- (char*) hexadecimalRepresentation: (NSUInteger*)length;
Availability: Not in OpenStep/MacOS-X
Returns a buffer containing an ASCII string with a nul terminated hexadecimal representation of the receiver, (and optionally the size of the buffer excluding the trailing nul terminator).

### initWithHexadecimalRepresentation:

- (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.

### isGzipped

- (BOOL) isGzipped;
Availability: Not in OpenStep/MacOS-X
Returns `YES` if the receiver is a non-empty data object with a gzip header, `NO` otherwise.

### md5Digest

- (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.

Up