# NSObject (GPGDataSource)

> Declared In:
>   GPGME/GPGData.h

## Category Description

This category declares methods that need to be implemented by GPGData data sources. Data sources can be readable or writable.

## Method Types

>   - data:readDataOfLength:
>   - data:writeData:
>   - data:seekToFileOffset:offsetType:
>   - dataRelease:

## Instance Methods

### data:readDataOfLength:

`- (NSData *)data:(GPGData *)data readDataOfLength:(unsigned int)maxLength`

Reads up to maxLength bytes of data and returns it. Returning an empty data or nil means that there is nothing more to read (EOF). Only required for input data objects.

Reading must be performed from the current position.

In case of error, raise a GPGException of type GPGError_E*.

Returned data will be copied.

### data:seekToFileOffset:offsetType:

`- (unsigned long long)data:(GPGData *)data seekToFileOffset:(unsigned long long)fileOffset offsetType:(GPGDataOffsetType)offsetType`

Changes the read/write position according to fileOffset and offsetType. Returns the new absolute position. Optional method.

In case of error, raise a GPGException of type GPGError_E*.

### data:writeData:

`- (unsigned long long)data:(GPGData *)data writeData:(NSData *)writeData`

Writes writeData from the current position. Returns the number of bytes written. Only required for output data objects.

In case of error, raise a GPGException of type GPGError_E*.

### dataRelease:

`- (void)dataRelease:(GPGData *)data`

Releases internal resources owned by the data source. Optional method.

Version 1.1 Copyright ©2005 by Mac GPG Project. All Rights Reserved. Sun Jan 23 16:54:41 2005