SignDoc SDK (C)  5.0.0
SIGNDOC_InputStream Class Reference

Interface for an input stream, inspired by Java's java.io.InputStream. More...

#include <SignDocSDK-c.h>

Public Member Functions

struct SIGNDOC_InputStreamSIGNDOC_FileInputStream_newWithFile (struct SIGNDOC_Exception **aEx, FILE *aFile)
 SIGNDOC_FileInputStream constructor: Read from a C stream. More...
 
struct SIGNDOC_InputStreamSIGNDOC_FileInputStream_newWithFileAndPath (struct SIGNDOC_Exception **aEx, FILE *aFile, const char *aPath)
 SIGNDOC_FileInputStream constructor: Read from a C stream. More...
 
struct SIGNDOC_InputStreamSIGNDOC_FileInputStream_newWithPath (struct SIGNDOC_Exception **aEx, const char *aPath)
 SIGNDOC_FileInputStream constructor: Open a file in binary mode. More...
 
struct SIGNDOC_InputStreamSIGNDOC_FileInputStream_newWithPathW (struct SIGNDOC_Exception **aEx, const wchar_t *aPath)
 SIGNDOC_FileInputStream constructor: Open a file in binary mode. More...
 
struct SIGNDOC_InputStreamSIGNDOC_UserInputStream_new (struct SIGNDOC_Exception **aEx, void *aClosure, SIGNDOC_UserInputStream_close aClose, SIGNDOC_UserInputStream_read aRead, SIGNDOC_UserInputStream_seek aSeek, SIGNDOC_UserInputStream_tell aTell, SIGNDOC_UserInputStream_getAvailable aGetAvailable)
 SIGNDOC_UserInputStream constructor. More...
 
void SIGNDOC_InputStream_delete (struct SIGNDOC_InputStream *aObj)
 SIGNDOC_InputStream destructor. More...
 
int SIGNDOC_InputStream_read (struct SIGNDOC_Exception **aEx, struct SIGNDOC_InputStream *aObj, void *aDst, int aLen)
 Read octets from a SIGNDOC_InputStream. More...
 
void SIGNDOC_InputStream_close (struct SIGNDOC_Exception **aEx, struct SIGNDOC_InputStream *aObj)
 Close a SIGNDOC_InputStream. More...
 
void SIGNDOC_InputStream_seek (struct SIGNDOC_Exception **aEx, struct SIGNDOC_InputStream *aObj, int aPos)
 Seek to the specified position in a SIGNDOC_InputStream. More...
 
int SIGNDOC_InputStream_tell (struct SIGNDOC_Exception **aEx, struct SIGNDOC_InputStream *aObj)
 Retrieve the current position of a SIGNDOC_InputStream. More...
 
int SIGNDOC_InputStream_getAvailable (struct SIGNDOC_Exception **aEx, struct SIGNDOC_InputStream *aObj)
 Get an estimate of the number of octets available for reading from a SIGNDOC_InputStream. More...
 
struct SIGNDOC_InputStreamSIGNDOC_MemoryInputStream_new (struct SIGNDOC_Exception **aEx, const unsigned char *aSrc, size_t aLen)
 SIGNDOC_MemoryInputStream constructor. More...
 

Detailed Description

Interface for an input stream, inspired by Java's java.io.InputStream.

Member Function Documentation

struct SIGNDOC_InputStream * SIGNDOC_FileInputStream_newWithFile ( struct SIGNDOC_Exception **  aEx,
FILE *  aFile 
)

SIGNDOC_FileInputStream constructor: Read from a C stream.

Parameters
[out]aExAny exception will be returned in the object pointed to by this parameter.
[in]aFileThe C stream to be wrapped.
Returns
A pointer to a new SIGNDOC_InputStream object or NULL on error.
struct SIGNDOC_InputStream * SIGNDOC_FileInputStream_newWithFileAndPath ( struct SIGNDOC_Exception **  aEx,
FILE *  aFile,
const char *  aPath 
)

SIGNDOC_FileInputStream constructor: Read from a C stream.

Parameters
[out]aExAny exception will be returned in the object pointed to by this parameter.
[in]aFileThe C stream to be wrapped.
[in]aPathThe pathname (native encoding), used in exceptions, can be NULL. See Using SignDoc SDK in Windows Store apps for restrictions on pathnames in Windows Store apps.
Returns
A pointer to a new SIGNDOC_InputStream object or NULL on error.
struct SIGNDOC_InputStream * SIGNDOC_FileInputStream_newWithPath ( struct SIGNDOC_Exception **  aEx,
const char *  aPath 
)

SIGNDOC_FileInputStream constructor: Open a file in binary mode.

Throws an exception of type SIGNDOC_EXCEPTION_TYPE_SPOOC_IO on error.

Parameters
[out]aExAny exception will be returned in the object pointed to by this parameter.
[in]aPathThe name of the file to be opened (native encoding). See Using SignDoc SDK in Windows Store apps for restrictions on pathnames in Windows Store apps.
Returns
A pointer to a new SIGNDOC_InputStream object or NULL on error.
struct SIGNDOC_InputStream * SIGNDOC_FileInputStream_newWithPathW ( struct SIGNDOC_Exception **  aEx,
const wchar_t *  aPath 
)

SIGNDOC_FileInputStream constructor: Open a file in binary mode.

Throws an exception of type SIGNDOC_EXCEPTION_TYPE_SPOOC_IO on error.

Parameters
[out]aExAny exception will be returned in the object pointed to by this parameter.
[in]aPathThe name of the file to be opened.
Returns
A pointer to a new SIGNDOC_InputStream object or NULL on error.
void SIGNDOC_InputStream_close ( struct SIGNDOC_Exception **  aEx,
struct SIGNDOC_InputStream aObj 
)

Close a SIGNDOC_InputStream.

Does not destroy the SIGNDOC_InputStream object.

Parameters
[out]aExAny exception will be returned in the object pointed to by this parameter.
[in]aObjA pointer to the SIGNDOC_InputStream object.
void SIGNDOC_InputStream_delete ( struct SIGNDOC_InputStream aObj)

SIGNDOC_InputStream destructor.

Parameters
[in]aObjA pointer to the SIGNDOC_InputStream object.
int SIGNDOC_InputStream_getAvailable ( struct SIGNDOC_Exception **  aEx,
struct SIGNDOC_InputStream aObj 
)

Get an estimate of the number of octets available for reading from a SIGNDOC_InputStream.

Throws an exception (type SIGNDOC_EXCEPTION_TYPE_SPOOC_IO) if this function is not supported.

Note
There may be more octets available than reported by this function, but never less. If there is at least one octet available for reading, the return value must be at least one. (That is, always returning zero is not possible.)
Parameters
[out]aExAny exception will be returned in the object pointed to by this parameter.
[in]aObjA pointer to the SIGNDOC_InputStream object.
Returns
The minimum number of octets available for reading.
int SIGNDOC_InputStream_read ( struct SIGNDOC_Exception **  aEx,
struct SIGNDOC_InputStream aObj,
void *  aDst,
int  aLen 
)

Read octets from a SIGNDOC_InputStream.

May throw an exception of type SIGNDOC_EXCEPTION_TYPE_SPOOC_IO.

Once this function has returned a value smaller than aLen, end of input has been reached and further calls should return 0.

Parameters
[out]aExAny exception will be returned in the object pointed to by this parameter.
[in]aObjA pointer to the SIGNDOC_InputStream object.
[out]aDstPointer to buffer to be filled.
[in]aLenNumber of octets to read.
Returns
The number of octets read.
void SIGNDOC_InputStream_seek ( struct SIGNDOC_Exception **  aEx,
struct SIGNDOC_InputStream aObj,
int  aPos 
)

Seek to the specified position in a SIGNDOC_InputStream.

Throws an exception (type SIGNDOC_EXCEPTION_TYPE_SPOOC_IO) if the position is invalid or if seeking is not supported.

Parameters
[out]aExAny exception will be returned in the object pointed to by this parameter.
[in]aObjA pointer to the SIGNDOC_InputStream object.
[in]aPosThe position (zero being the first octet).
int SIGNDOC_InputStream_tell ( struct SIGNDOC_Exception **  aEx,
struct SIGNDOC_InputStream aObj 
)

Retrieve the current position of a SIGNDOC_InputStream.

Throws an exception (type SIGNDOC_EXCEPTION_TYPE_SPOOC_IO) if seeking is not supported or if the position cannot be represented as non-negative int.

Parameters
[out]aExAny exception will be returned in the object pointed to by this parameter.
[in]aObjA pointer to the SIGNDOC_InputStream object.
Returns
The current position (zero being the first octet)
struct SIGNDOC_InputStream * SIGNDOC_MemoryInputStream_new ( struct SIGNDOC_Exception **  aEx,
const unsigned char *  aSrc,
size_t  aLen 
)

SIGNDOC_MemoryInputStream constructor.

Read from the buffer pointed to by aSrc. Note that the buffer contents won't be copied, therefore the buffer must remain valid throughout the use of this object.

Parameters
[out]aExAny exception will be returned in the object pointed to by this parameter.
[in]aSrcPoints to the stream contents.
[in]aLenSize of the stream contents.
Returns
A pointer to a new SIGNDOC_InputStream object or NULL on error.
struct SIGNDOC_InputStream * SIGNDOC_UserInputStream_new ( struct SIGNDOC_Exception **  aEx,
void *  aClosure,
SIGNDOC_UserInputStream_close  aClose,
SIGNDOC_UserInputStream_read  aRead,
SIGNDOC_UserInputStream_seek  aSeek,
SIGNDOC_UserInputStream_tell  aTell,
SIGNDOC_UserInputStream_getAvailable  aGetAvailable 
)

SIGNDOC_UserInputStream constructor.

Parameters
[out]aExAny exception will be returned in the object pointed to by this parameter.
[in]aClosureA pointer to user-defined object that will be passed to the callbacks.
[in]aClosePointer to function implementing close().
[in]aReadPointer to function implementing read().
[in]aSeekPointer to function implementing seek().
[in]aTellPointer to function implementing tell().
[in]aGetAvailablePointer to function implementing getAvailable().
Returns
A pointer to a new SIGNDOC_InputStream object or NULL on error.

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