Adobe.com
Contents Suites Classes Class Index Member Index

AIDataFilterSuite Struct Reference
[API Suite List]

A data filter is an object that bytes of data can be read from or written to. More...

#include <AIDataFilter.h>

List of all members.

Public Attributes

AIAPI AIErr(* LinkDataFilter )(AIDataFilter *prev, AIDataFilter *next)
 Initializes a filter and links it to the previous filter for input or output.
AIAPI AIErr(* UnlinkDataFilter )(AIDataFilter *next, AIDataFilter **prev)
 Terminates a filter.
AIAPI AIErr(* ReadDataFilter )(AIDataFilter *filter, char *store, size_t *count)
 Reads data from the filter's source stream.
AIAPI AIErr(* WriteDataFilter )(AIDataFilter *filter, const char *store, size_t *count)
 Writes data to the filter's destination stream.
AIAPI AIErr(* SeekDataFilter )(AIDataFilter *filter, ai::sizediff_t *count)
 Seeks to a position in a filter's stream, as returned by MarkDataFilter().
AIAPI AIErr(* MarkDataFilter )(AIDataFilter *filter, ai::sizediff_t *count)
 Reports the current position in a filter's stream.
AIAPI AIErr(* NewFileDataFilter )(const ai::FilePath &spec, const char *mode, size_t creator, ai::int32 type, AIDataFilter **filter)
 Creates a new file data filter that reads to or writes from a file.
AIAPI AIErr(* NewBufferDataFilter )(size_t size, AIDataFilter **filter)
 Creates a new buffer data filter that reads from or writes to a linked filter, buffering data into chunks of a specified size.
AIAPI AIErr(* NewHexdecDataFilter )(char *state, ai::int32 shift, AIDataFilter **filter)
 Creates a new ASCIIHEX data filter that encodes or decodes data from a linked filter using ASCII Hex.
AIAPI AIErr(* NewBlockDataFilter )(void *address, size_t size, AIDataFilter **filter)
 Creates a new block data filter that reads from and writes to a specified block of memory.
AIAPI AIErr(* NewVMDataFilter )(size_t initialsize, AIDataFilter **filter)
 Creates a new random access data filter that reads from and writes to Illustrator's virtual memory.
AIAPI AIErr(* NewA85DataFilter )(char *statestr, const char *prefix, AIDataFilter **filter)
 Creates a new ASCII85 data filter that encodes or decodes data from a linked filter.
AIAPI AIErr(* NewZDataFilter )(const char *statestr, AIDataFilter **filter)
 Creates a new ZLib data filter that compresses or decompresses data from a linked filter.
AIAPI AIErr(* NewPluginStream )(AIPluginStream *stream, AIDataFilter **filter)
 Creates a new data filter for a stream with specified methods.
AIAPI AIErr(* NewResourceDataFilter )(SPPluginRef plugin, ai::int32 type, ai::int32 id, const char *name, AIDataFilter **filter)
 Creates a data filter for streaming data from a plug-in resource.

Detailed Description

A data filter is an object that bytes of data can be read from or written to.

The filter usually does something interesting with those bytes. For example, it might write them to a disk file, send them over a network or it could perform JPEG encoding and decoding.

This suite provides functions to create filters that read and write files, buffers, or memory blocks, and that encode/decode and compress/decompress data.

Data filters can be linked together. Each filter in the linked chain gets data from or puts data to the previous filter. A file filter could, for example, be linked to an ASCII encoding filter which is in turn linked to a binary compression filter. The result is a composite filter that compresses and ASCII-encodes data before writing it to a file.

The following code shows how to set up a data filter that performs buffered writes to a file. Note that LinkDataFilter() must be called even for the first filter as it initializes the filter.

AIErr result = kNoErr;
AIDataFilter* dstfilter = NULL;
AIDataFilter* filter;
if (!result)
        result = sAIDataFilter->NewFileDataFilter(file, "write", 'ART5', 'TEXT', &filter);
if (!result) {
        result = sAIDataFilter->LinkDataFilter(dstfilter, filter);
        dstfilter = filter;
}
if (!result)
        result = sAIDataFilter->NewBufferDataFilter(32*1024, &filter);
if (!result) {
        result = sAIDataFilter->LinkDataFilter(dstfilter, filter);
        dstfilter = filter;
}

When you have finished with a filter, you can use the following code to close it.

AIErr result = kNoErr;
while (dstfilter)  {
        AIErr tmpresult = sAIDataFilter->UnlinkDataFilter(dstfilter, &dstfilter);
        if (!result)
                result = tmpresult;
}

Member Data Documentation

Initializes a filter and links it to the previous filter for input or output.

Parameters:
prev A pointer to the previous filter (the source or destination of data read or written by this filter). Can be null for the first filter in a chain, or a filter that is not linked.
next A pointer to the filter to initialize and link.

Reports the current position in a filter's stream.

Parameters:
filter A pointer to the filter.
count [out] A buffer in which to return the position, an offset into the stream.
AIAPI AIErr(* AIDataFilterSuite::NewA85DataFilter)(char *statestr, const char *prefix, AIDataFilter **filter)

Creates a new ASCII85 data filter that encodes or decodes data from a linked filter.

The resulting sequence of characters is broken up into lines by inserting line break characters as needed. Each line can additionally be preceded by a prefix string.

Parameters:
statestr Whether the filter is encoding or decoding, one of:

  • "write" (encoding)
  • "read" (decoding)
prefix The string to insert at the start of each line.
filter [out] A buffer in which to return the new filter reference.
AIAPI AIErr(* AIDataFilterSuite::NewBlockDataFilter)(void *address, size_t size, AIDataFilter **filter)

Creates a new block data filter that reads from and writes to a specified block of memory.

Parameters:
address The address of the block.
size The number of bytes in the block.
filter [out] A buffer in which to return the new filter reference.

Creates a new buffer data filter that reads from or writes to a linked filter, buffering data into chunks of a specified size.

Parameters:
size The number of bytes to read or write at a time.
filter [out] A buffer in which to return the new filter reference.
AIAPI AIErr(* AIDataFilterSuite::NewFileDataFilter)(const ai::FilePath &spec, const char *mode, size_t creator, ai::int32 type, AIDataFilter **filter)

Creates a new file data filter that reads to or writes from a file.

Parameters:
spec The file associated with the filter.
mode How the filter is used, one of "read", "write", or "append".
creator The file creator (for Mac OS)
type The file type (for Mac OS)
filter [out] A buffer in which to return the new filter reference.
AIAPI AIErr(* AIDataFilterSuite::NewHexdecDataFilter)(char *state, ai::int32 shift, AIDataFilter **filter)

Creates a new ASCIIHEX data filter that encodes or decodes data from a linked filter using ASCII Hex.

That is, it uses the characters 0-9 and A-F to represent hexadecimal numbers. The resulting sequence of characters is broken up into lines by inserting line break characters as needed. Each line can additionally be preceded by a number of tab characters.

Parameters:
state Whether the filter is encoding or decoding, one of:

  • "write" (encoding)
  • "read" (decoding)
shift The number of tab characters to insert before each line.
filter [out] A buffer in which to return the new filter reference.

Creates a new data filter for a stream with specified methods.

It is typically at one end of a filter chain, to act as a data source or sink.

Parameters:
stream The stream, which you have initialized with a set of data-handling procedures.
filter [out] A buffer in which to return the new filter reference, .
AIAPI AIErr(* AIDataFilterSuite::NewResourceDataFilter)(SPPluginRef plugin, ai::int32 type, ai::int32 id, const char *name, AIDataFilter **filter)

Creates a data filter for streaming data from a plug-in resource.

Searches for a resource of a given type in the plug-in's resource file. Identify the specific resource using either a numeric ID or name string. The type, ID, and name are defined by the plug-in that owns the resource

Parameters:
plugin The plug-in object for the plug-in that owns the resource.
type The resource type constant, a 4-byte value.
id The unique resource identifier.
name The resource name.
filter [out] A buffer in which to return the new filter reference, .
AIAPI AIErr(* AIDataFilterSuite::NewVMDataFilter)(size_t initialsize, AIDataFilter **filter)

Creates a new random access data filter that reads from and writes to Illustrator's virtual memory.

Use to create a temporary file that is paged to and from memory as needed.

Parameters:
initialsize The end of the initial stream, a number of bytes. If NULL, the initial stream is empty.
filter [out] A buffer in which to return the new filter reference.
AIAPI AIErr(* AIDataFilterSuite::NewZDataFilter)(const char *statestr, AIDataFilter **filter)

Creates a new ZLib data filter that compresses or decompresses data from a linked filter.

Parameters:
statestr Whether the filter is compressing or decompressing, one of:

  • "write" (compressing)
  • "read" (decompressing)
filter [out] A buffer in which to return the new filter reference.
AIAPI AIErr(* AIDataFilterSuite::ReadDataFilter)(AIDataFilter *filter, char *store, size_t *count)

Reads data from the filter's source stream.

Parameters:
filter A pointer to the filter.
store [out] A buffer in which to return the data.
count [in, out] A pointer to the maximum number of bytes to read. Returns the number of bytes actually read, 0 if the stream is exhausted.

Seeks to a position in a filter's stream, as returned by MarkDataFilter().

Not all data filters support random access.

Parameters:
filter A pointer to the filter.
count A pointer to the new position, an offset into the stream.

Terminates a filter.

If the filter is writing, flushes any writes.

Parameters:
next A pointer to the filter to terminate.
prev [out] A buffer in which to return a pointer to the previous linked filter, which contains any data written before termination.
AIAPI AIErr(* AIDataFilterSuite::WriteDataFilter)(AIDataFilter *filter, const char *store, size_t *count)

Writes data to the filter's destination stream.

Parameters:
filter A pointer to the filter.
store A buffer containing the data.
count A pointer to the number of bytes in store.

The documentation for this struct was generated from the following file:


Contents Suites Classes Class Index Member Index
Adobe Solutions Network
 
Copyright © 2016 Adobe Systems Incorporated. All rights reserved.
Terms of Use Online Privacy Policy Adobe and accessibility Avoid software piracy Permissions and Trademarks