Layer | AS_Layer |
Object | ASStm |
An ASStm is a data stream that may be a buffer in memory, a file, or an arbitrary user-written procedure. You typically would use an ASStm to extract data from a PDF file. When writing or extracting data streams, the ASStm must be connected to a Cos stream. ASStm methods allow you to open and close streams, and to read and write data.
Typedef | ||
---|---|---|
ASProcStmRdExHandler | ||
ASProcStmRdExHandlerRec | ||
ASStm | ||
ASStmRec
A stream object definition (see ASStream.h). It is a data stream that may be a buffer in memory, a file, or an arbitrary user-written procedure. It is typically used to extract data from a PDF file. When writing or extracting data streams, the ASStm must be connected to a Cos stream.
|
Structure | ||
---|---|---|
_s_ASProcStmRdExHandler
For use by ASProcStmRdOpenEx().
|
Callback | ||
---|---|---|
ASProcStmDestroyProc
A callback for use by ASProcStmWrOpen() and ASProcStmRdOpenEx().
|
||
ASProcStmGetLength
A callback for use by ASProcStmRdOpenEx().
|
||
ASProcStmSeekProc
A callback for use by ASProcStmRdOpenEx().
|
||
ASStmProc
A callback for use by ASProcStmRdOpenEx() and ASProcStmWrOpen(). This should place data in the buffer specified by the parameter data.
|
Method | ||
---|---|---|
Creates a read-only ASStm from a file. The stream supports seek operations.
|
||
Creates a writable ASStm from a file. The stream supports seek operations.
|
||
ASStm ASMemStmRdOpen(const char* data, ASArraySize len)
Creates a read-only ASStm from a memory-resident buffer. The stream supports seek operations.
|
||
ASStm ASProcStmRdOpen(ASStmProc readProc, void* clientData)
Creates a read-only ASStm from an arbitrary data-producing procedure. The stream does not support seek operations.
|
||
ASStm ASProcStmRdOpenEx(ASProcStmRdExHandler handler, void* clientData)
Extends ASProcStmRdOpen() and creates a read-only ASStm from an arbitrary data-producing procedure. The stream optionally supports seek operations, although external clients do not have the ability to initiate a seek operation.
|
||
Creates an ASStm from an arbitrary data-producing procedure. The stream does not support seek operations.
|
||
void ASStmClose(ASStm stm)
Closes the specified stream.
|
||
ASTCount ASStmFlush(ASStm stm)
Flushes any buffered data to the specified stream.
|
||
Reads data from stm into memory.
|
||
Writes data from a memory buffer into an ASStm.
|
ASProcStmRdExHandler |
Product availability: All |
Platform availability: All |
typedef _s_ASProcStmRdExHandler ASProcStmRdExHandler;
File: ASExpT.h |
Line: 556 |
ASProcStmRdExHandlerRec |
Product availability: All |
Platform availability: All |
typedef _s_ASProcStmRdExHandler ASProcStmRdExHandlerRec;
File: ASExpT.h |
Line: 556 |
ASStm |
Product availability: All |
Platform availability: All |
typedef struct _t_ASStmRec* ASStm;
File: ASExpT.h |
Line: 274 |
ASStmRec |
Product availability: All |
Platform availability: All |
typedef struct _t_ASStmRec ASStmRec;
A stream object definition (see ASStream.h). It is a data stream that may be a buffer in memory, a file, or an arbitrary user-written procedure. It is typically used to extract data from a PDF file. When writing or extracting data streams, the ASStm must be connected to a Cos stream.
See Also
File: ASExpT.h |
Line: 274 |
_s_ASProcStmRdExHandler |
Product availability: All |
Platform availability: All |
struct _s_ASProcStmRdExHandler {
ASByteCount size;
ASStmProc readProc;
ASProcStmDestroyProc destroyProc;
ASProcStmSeekProc seekProc;
ASProcStmGetLength getLengthProc;
ASByteCount bufSize;
}
For use by ASProcStmRdOpenEx().
File: ASExpT.h |
Line: 540 |
size | Set to |
|
bufSize | The size of the buffer to use for the stream. If this field is missing, the default is |
ASProcStmDestroyProc |
Product availability: All |
Platform availability: All |
void (*ASProcStmDestroyProc)(void *clientData)
A callback for use by ASProcStmWrOpen() and ASProcStmRdOpenEx().
This is called at the end of the stream so you can do clean up and free allocated memory.
See Also
File: ASExpT.h |
Line: 504 |
ASProcStmGetLength |
Product availability: All |
Platform availability: All |
ASFilePos64 (*ASProcStmGetLength)(void *clientData)
A callback for use by ASProcStmRdOpenEx().
This is called to get the length of the stream, which may be NULL
if the stream cannot be set to a new position. ASProcStmSeekProc() and ASProcStmGetLength() must be provided together. If either is NULL
, the stream will not be set to a new position.
See Also
File: ASExpT.h |
Line: 536 |
ASProcStmSeekProc |
Product availability: All |
Platform availability: All |
void (*ASProcStmSeekProc)(ASFilePos64 newPos, void *clientData)
A callback for use by ASProcStmRdOpenEx().
This is called to set the stream position to a new location, which may be NULL
if the stream cannot be set to a new position. ASProcStmSeekProc() and ASProcStmGetLength() must be provided together. If either is NULL
, the stream will not be set to a new position.
See Also
File: ASExpT.h |
Line: 520 |
ASStmProc |
Product availability: All |
Platform availability: All |
ASTCount (*ASStmProc)(char *data, ASTArraySize nData, void *clientData)
A callback for use by ASProcStmRdOpenEx() and ASProcStmWrOpen(). This should place data in the buffer specified by the parameter data.
If your procedure reads data from a file, it is generally quite inefficient to open the file, read the bytes, and close the file each time bytes are requested. Instead, consider opening the file the first time bytes are requested from it, reading the entire file into a secondary buffer, and closing the file. When subsequent requests for data from the file are received, simply copy data from the secondary buffer, rather than reopening the file.
See Also
File: ASExpT.h |
Line: 489 |
ASFileStmRdOpen | () |
Product availability: All |
Platform availability: All |
ASStm ASFileStmRdOpen(ASFile afile, ASSmallBufferSize bufSize)
Creates a read-only ASStm from a file. The stream supports seek operations.
Parameters
afile — | The open file to associate with the stream. The file must have been opened previously using ASFileSysOpenFile(). Each open file has a unique ASFile. The ASFile value has meaning only to the common ASFile implementation and bears no relationship to platform-specific file objects. |
|
bufSize — | The length in bytes of the data buffer. If |
The newly created ASStm. |
See Also
Since
File: ASProcs.h |
Line: 1064 |
ASFileStmWrOpen | () |
Product availability: All |
Platform availability: All |
ASStm ASFileStmWrOpen(ASFile afile, ASSmallBufferSize bufSize)
Creates a writable ASStm from a file. The stream supports seek operations.
Parameters
afile — | The open file to associate with the stream. The file must have been opened previously using ASFileSysOpenFile(). Each open file has a unique ASFile. The ASFile value has meaning only to the common ASFile implementation and bears no relationship to platform-specific file objects. |
|
bufSize — | The length in bytes of a data buffer. If |
The newly created ASStm. |
See Also
Exceptions
Since
File: ASProcs.h |
Line: 1546 |
ASMemStmRdOpen | () |
Product availability: All |
Platform availability: All |
ASStm ASMemStmRdOpen(const char* data, ASArraySize len)
Creates a read-only ASStm from a memory-resident buffer. The stream supports seek operations.
Parameters
data — | A buffer containing the data to read into the stream. This data buffer must not be disposed of until the ASStm is closed. |
|
len — |
The newly created ASStm. |
See Also
Since
File: ASProcs.h |
Line: 1081 |
ASProcStmRdOpen | () |
Product availability: All |
Platform availability: All |
Creates a read-only ASStm from an arbitrary data-producing procedure. The stream does not support seek operations.
readProc
is called when the client of the stream attempts to read data from it.
Parameters
readProc — | A user-supplied callback that supplies the stream's data. |
|
clientData — | A pointer to user-supplied data to pass to |
The newly created ASStm. |
See Also
Exceptions
Since
File: ASProcs.h |
Line: 1102 |
ASProcStmRdOpenEx | () |
Product availability: All |
Platform availability: All |
ASStm ASProcStmRdOpenEx(ASProcStmRdExHandler handler, void* clientData)
Extends ASProcStmRdOpen() and creates a read-only ASStm from an arbitrary data-producing procedure. The stream optionally supports seek operations, although external clients do not have the ability to initiate a seek operation.
The supplied handlers are called when the client of the stream attempts to read data from it, seek it, or find it's length, as well as when the client closes it.
Parameters
handler — | A structure containing user-supplied callbacks that supply the stream's data and destroy the stream. |
|
clientData — | A pointer to user-supplied data to pass to the procedures each time they are called. |
The newly created ASStm. |
See Also
Exceptions
Since
File: ASProcs.h |
Line: 2123 |
ASProcStmWrOpen | () |
Product availability: All |
Platform availability: All |
ASStm ASProcStmWrOpen(ASStmProc writeProc, ASProcStmDestroyProc destroyProc, void* clientData)
Creates an ASStm from an arbitrary data-producing procedure. The stream does not support seek operations.
Parameters
writeProc — | A user-supplied callback that provides the data for the stream. |
|
destroyProc — | A user-supplied callback that destroys the specified ASStm. (Generally, this means deallocating the memory associated with the ASStm.) |
|
clientData — | A pointer to user-supplied data to pass to |
The newly created ASStm. |
See Also
Exceptions
Since
File: ASProcs.h |
Line: 1516 |
ASStmClose | () |
Product availability: All |
Platform availability: All |
void ASStmClose(ASStm stm)
Closes the specified stream.
Parameters
stm — | The stream to close. |
See Also
Since
File: ASProcs.h |
Line: 1163 |
ASStmFlush | () |
Product availability: All |
Platform availability: All |
Flushes any buffered data to the specified stream.
Parameters
stm — | The stream to flush. |
|
See Also
Since
File: ASProcs.h |
Line: 2436 |
ASStmRead | () |
Product availability: All |
Platform availability: All |
ASTCount ASStmRead(char* ptr, ASTArraySize itemSize, ASTCount nItems, ASStm stm)
Reads data from stm
into memory.
Parameters
ptr — | (Filled by the method) A buffer into which data is written. |
|
itemSize — | The number of bytes in a stream item. See the description of |
|
nItems — | The number of items to read. The amount of data read into the memory buffer will be |
|
stm — |
The number of items (not bytes) read. |
See Also
Since
File: ASProcs.h |
Line: 1122 |
ASStmWrite | () |
Product availability: All |
Platform availability: All |
ASTCount ASStmWrite(const char* ptr, ASTArraySize itemSize, ASTCount nItems, ASStm stm)
Writes data from a memory buffer into an ASStm.
You cannot use this method to change a PDF page content stream. It can only be used for a print stream. .
Historically, this method was provided to allow plug-ins to write data into the print stream when printing to a PostScript printer (see the PDDocWillPrintPage() notification). However, ASStm is a general purpose I/O mechanism in Acrobat even though only limited open and read/write methods are provided in the plug-in API. For instance, not all ASStm objects support seek operations.
Parameters
ptr — | ||
itemSize — | The number of bytes in a stream item. See the description of |
|
nItems — | The number of items to write. The amount of data written into the stream will be |
|
stm — | The stream into which data is written. |
The number of items (not bytes) written. |
See Also
Since
File: ASProcs.h |
Line: 1152 |