Top | ![]() |
![]() |
![]() |
![]() |
An class providing an I/O writer abstraction that allows generating
output that can be stored or passed on to system files, strings
allocated in memory (usually via raptor_stringbuffer), system
file handles (FILE*
) or to a user function.
int
(*raptor_iostream_init_func) (void *context
);
Handler function for raptor_iostream initialising.
void
(*raptor_iostream_finish_func) (void *context
);
Handler function for raptor_iostream terminating.
int (*raptor_iostream_write_byte_func) (void *context
,const int byte
);
Handler function for implementing raptor_iostream_write_byte()
.
int (*raptor_iostream_write_bytes_func) (void *context
,const void *ptr
,size_t size
,size_t nmemb
);
Handler function for implementing raptor_iostream_write_bytes()
.
int
(*raptor_iostream_write_end_func) (void *context
);
Handler function for implementing raptor_iostream_write_end()
.
int (*raptor_iostream_read_bytes_func) (void *context
,void *ptr
,size_t size
,size_t nmemb
);
Handler function for implementing raptor_iostream_read_bytes()
.
int
(*raptor_iostream_read_eof_func) (void *context
);
Handler function for implementing raptor_iostream_read_eof()
.
raptor_iostream * raptor_new_iostream_from_handler (raptor_world *world
,void *user_data
,const raptor_iostream_handler * const handler
);
raptor_iostream *
raptor_new_iostream_from_sink (raptor_world *world
);
raptor_iostream * raptor_new_iostream_from_filename (raptor_world *world
,const char *filename
);
raptor_iostream * raptor_new_iostream_from_file_handle (raptor_world *world
,FILE *handle
);
raptor_iostream * raptor_new_iostream_from_string (raptor_world *world
,void *string
,size_t length
);
raptor_iostream * raptor_new_iostream_to_filename (raptor_world *world
,const char *filename
);
raptor_iostream * raptor_new_iostream_to_file_handle (raptor_world *world
,FILE *handle
);
raptor_iostream * raptor_new_iostream_to_string (raptor_world *world
,void **string_p
,size_t *length_p
,raptor_data_malloc_handler const malloc_handler
);
int raptor_iostream_hexadecimal_write (unsigned int integer
,int width
,raptor_iostream *iostr
);
int raptor_iostream_read_bytes (void *ptr
,size_t size
,size_t nmemb
,raptor_iostream *iostr
);
int raptor_iostream_counted_string_write (const void *string
,size_t len
,raptor_iostream *iostr
);
int raptor_iostream_decimal_write (int integer
,raptor_iostream *iostr
);
int raptor_iostream_string_write (const void *string
,raptor_iostream *iostr
);
int raptor_iostream_write_byte (const int byte
,raptor_iostream *iostr
);
int raptor_iostream_write_bytes (const void *ptr
,size_t size
,size_t nmemb
,raptor_iostream *iostr
);
int raptor_bnodeid_ntriples_write (const unsigned char *bnodeid
,size_t len
,raptor_iostream *iostr
);
int raptor_string_escaped_write (const unsigned char *string
,size_t len
,const char delim
,unsigned int flags
,raptor_iostream *iostr
);
int raptor_term_escaped_write (const raptor_term *term
,unsigned int flags
,raptor_iostream *iostr
);
int raptor_uri_escaped_write (raptor_uri *uri
,raptor_uri *base_uri
,unsigned int flags
,raptor_iostream *iostr
);
int raptor_string_ntriples_write (const unsigned char *string
,size_t len
,const char delim
,raptor_iostream *iostr
);
int raptor_string_python_write (const unsigned char *string
,size_t len
,const char delim
,unsigned int mode
,raptor_iostream *iostr
);
raptor_string_python_write
is deprecated and should not be used in newly-written code.
typedef struct { int version; /* V1 functions */ raptor_iostream_init_func init; raptor_iostream_finish_func finish; raptor_iostream_write_byte_func write_byte; raptor_iostream_write_bytes_func write_bytes; raptor_iostream_write_end_func write_end; /* V2 functions */ raptor_iostream_read_bytes_func read_bytes; raptor_iostream_read_eof_func read_eof; } raptor_iostream_handler;
I/O stream implementation handler structure.
interface version. Presently 1 or 2. |
||
initialisation handler - optional, called at most once (V1) |
||
raptor_iostream_finish_func |
finishing handler - optional, called at most once (V1) |
|
raptor_iostream_write_byte_func |
write byte handler - required (for writing) (V1) |
|
raptor_iostream_write_bytes_func |
write bytes handler - required (for writing) (V1) |
|
raptor_iostream_write_end_func |
write end handler - optional (for writing), called at most once (V1) |
|
raptor_iostream_read_bytes_func |
read bytes handler - required (for reading) (V2) |
|
raptor_iostream_read_eof_func |
read EOF handler - required (for reading) (V2) |
Bit flags for raptor_string_escaped_write()
and friends.
Allow \b \f, |
||
ALlow \t \n \r \u |
||
Allow UTF-8 for printable U * |
||
Must escape x00-x20<>\"{}|^` in URIs |
||
N-Triples literal |
||
N-Triples URI |
||
SPARQL literal: allows raw UTF8 for printable literals |
||
SPARQL long literal: no BS-escapes allowed |
||
SPARQL uri: have to escape certain characters |
||
Turtle 2013 URIs (like SPARQL) |
||
Turtle 2013 literals (like SPARQL) |
||
Turtle 2013 long literals (like SPARQL) |
||
JSON literals: \b \f \t \r \n and \u \U |