int16
. typedef
ASUns16
ASSmallBufferSize
;
typedef
struct
_t_ASStmRec
ASStmRec
,
*
ASStm
;
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.
void
ASProcStmDestroyProc(
void
*
clientData
);
clientData | IN/OUT User-supplied data that was passed in the call to ASProcStmWrOpen() or ASProcStmRdOpenEx().
|
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.
ASFilePos64
ASProcStmGetLength(
void
*
clientData
);
clientData | IN/OUT User-supplied data that was passed in the call to ASProcStmRdOpenEx().
|
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.
void
ASProcStmSeekProc(
ASFilePos64
newPos
,
void
*
clientData
);
newPos | |
clientData | IN/OUT User-supplied data that was passed in the call to ASProcStmRdOpenEx().
|
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.
ASTCount
ASStmProc(
char
*
data
,
ASTArraySize
nData
,
void
*
clientData
);
data | (Filled by the callback) The buffer into which your procedure must place the number of bytes specified by
nData . |
nData | The number of bytes to read from the stream and place into
data . |
clientData | User-supplied data that was passed in the call to ASProcStmRdOpenEx() or ASProcStmWrOpen().
|
nData
parameter unless the end of file marker (EOF) has been reached, an error has occurred, or this is short block of data just before EOF. If EOF has been reached, a zero should be returned. If an error has occurred, a negative value should be returned.
| |
Set to
sizeof(ASProcStmRdExHandlerRec) . | |
The size of the buffer to use for the stream. If this field is missing, the default is
65535 . If this field is present and has a value of 0 , then the default is implementation-specific. | |
|
ASStm
ASMemStmRdOpen(
const
char
*
data
,
ASArraySize
len
);
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 length in bytes of
data . |
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.
ASStm
ASProcStmRdOpen(
ASStmProc
readProc
,
void
*
clientData
);
readProc | A user-supplied callback that supplies the stream's data.
|
clientData | A pointer to user-supplied data to pass to
readProc each time it is called. |
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.
ASStm
ASProcStmRdOpenEx(
ASProcStmRdExHandler
handler
,
void
*
clientData
);
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.
|
ASStm
ASProcStmWrOpen(
ASStmProc
writeProc
,
ASProcStmDestroyProc
destroyProc
,
void
*
clientData
);
writeProc | A user-supplied callback that provides the data for the stream.
|
destroyProc | |
clientData | A pointer to user-supplied data to pass to
writeProc each time it is called. |
void
ASStmClose(
ASStm
stm
);
stm | The stream to close.
|
ASTCount
ASStmFlush(
ASStm
stm
);
stm | The stream to flush.
|
0
if successful, non-zero otherwise. stm
into memory. ASTCount
ASStmRead(
char
*
ptr
,
ASTArraySize
itemSize
,
ASTCount
nItems
,
ASStm
stm
);
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 for further information. |
nItems | The number of items to read. The amount of data read into the memory buffer will be
itemSize * nItems , unless an EOF is encountered first. The relative values of itemSize and nItems really do not matter; the only thing that matters is their product. It is often convenient to set itemSize to 1 , so that nItems is the number of bytes to read. |
stm | The stream from which data is read.
|
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.
ASTCount
ASStmWrite(
const
char
*
ptr
,
ASTArraySize
itemSize
,
ASTCount
nItems
,
ASStm
stm
);
ptr | A buffer from which data is read.
|
itemSize | The number of bytes in a stream item. See the description of
nItems for additional information. |
nItems | The number of items to write. The amount of data written into the stream will be
itemSize * nItems . The relative values of itemSize and nItems really do not matter; the only thing that matters is their product. It is often convenient to set itemSize to 1 , so that nItems is the number of bytes to read. |
stm | The stream into which data is written.
|