Inherits from NSObject
Declared in AGStringEncoding.h
AGStringEncoding.m

Overview

A generic class for arbitrary base-2 to 128 string encoding and decoding.

Tasks

Class Methods

stringEncodingWithString:

Creates and returns a new autoreleased AGStringEncoding object initialized by the given string.

+ (id)stringEncodingWithString:(NSString *)string

Parameters

string

The string to use.

Return Value

An AGStringEncoding object initialized by the given string.

Discussion

Creates and returns a new autoreleased AGStringEncoding object initialized by the given string.

Declared In

AGStringEncoding.h

Instance Methods

addDecodeSynonyms:

Add decoding synonyms as specified in the synonyms argument.

- (void)addDecodeSynonyms:(NSString *)synonyms

Parameters

synonyms

the sequence of synonyms.

Discussion

Add decoding synonyms as specified in the synonyms argument.

It should be a sequence of one previously reverse mapped character, followed by one or more non-reverse mapped character synonyms. Only 7-bit ASCII characters are permitted in the string.

e.g. If a GTMStringEncoder object has already been initialised with a set of characters excluding I, L and O (to avoid confusion with digits) and you want to accept them as digits you can call addDecodeSynonyms:@“0oO1iIlL”.

Declared In

AGStringEncoding.h

decode:

Decode a 7-bit ASCII string to a raw binary buffer.

- (NSData *)decode:(NSString *)string

Parameters

string

The string to decode

Return Value

The raw binary buffer

Discussion

Decode a 7-bit ASCII string to a raw binary buffer.

Declared In

AGStringEncoding.h

encode:

Encode a raw binary buffer to a 7-bit ASCII string.

- (NSString *)encode:(NSData *)data

Parameters

data

The data to encode

Return Value

The encoded string

Discussion

Encode a raw binary buffer to a 7-bit ASCII string.

Declared In

AGStringEncoding.h

ignoreCharacters:

A sequence of characters to ignore if they occur during encoding.

- (void)ignoreCharacters:(NSString *)chars

Parameters

chars

The sequence of chars to ignore.

Discussion

A sequence of characters to ignore if they occur during encoding.

Only 7-bit ASCII characters are permitted in the string.

Declared In

AGStringEncoding.h

initWithString:

Returns an AGStringEncoding object initialized by the specified string.

- (id)initWithString:(NSString *)string

Parameters

string

The string to use.

Return Value

An AGStringEncoding object initialized by the given string.

Discussion

Returns an AGStringEncoding object initialized by the specified string.

The length of the string must be a power of 2, at least 2 and at most 128. Only 7-bit ASCII characters are permitted in the string.

These characters are the canonical set emitted during encoding. If the characters have alternatives (e.g. case, easily transposed) then use addDecodeSynonyms: to configure them.

Declared In

AGStringEncoding.h