Main Page   Modules   Data Structures   File List   Data Fields  

generic byte streams

Generic byte-streams. More...

Typedefs

typedef svn_stream_t svn_stream_t
 An abstract stream of bytes--either incoming or outgoing or both. More...

typedef svn_error_t *(* svn_read_fn_t )(void *baton, char *buffer, apr_size_t *len)
 Read handler function for a generic stream.

typedef svn_error_t *(* svn_write_fn_t )(void *baton, const char *data, apr_size_t *len)
 Write handler function for a generic stream.

typedef svn_error_t *(* svn_close_fn_t )(void *baton)
 Close handler function for a generic stream.


Functions

svn_stream_tsvn_stream_create (void *baton, apr_pool_t *pool)
 Creating a generic stream.

void svn_stream_set_baton (svn_stream_t *stream, void *baton)
 Set stream's baton to baton.

void svn_stream_set_read (svn_stream_t *stream, svn_read_fn_t read_fn)
 Set stream's read function to read_fn.

void svn_stream_set_write (svn_stream_t *stream, svn_write_fn_t write_fn)
 Set stream's write function to write_fn.

void svn_stream_set_close (svn_stream_t *stream, svn_close_fn_t close_fn)
 Set stream's close function to close_fn.

svn_stream_tsvn_stream_empty (apr_pool_t *pool)
 Convenience function to create a generic stream which is empty.

svn_stream_tsvn_stream_from_aprfile (apr_file_t *file, apr_pool_t *pool)
 Convenience function for creating streams which operate on APR files. More...

svn_error_tsvn_stream_for_stdout (svn_stream_t **out, apr_pool_t *pool)
 Set *out to a generic stream connected to stdout, allocated in pool. More...

svn_stream_tsvn_stream_from_stringbuf (svn_stringbuf_t *str, apr_pool_t *pool)
 Return a generic stream connected to stringbuf str. More...

svn_stream_tsvn_stream_compressed (svn_stream_t *stream, apr_pool_t *pool)
 Return a stream that decompresses all data read and compresses all data written. More...

svn_error_tsvn_stream_read (svn_stream_t *stream, char *buffer, apr_size_t *len)
 Read from a generic stream.

svn_error_tsvn_stream_write (svn_stream_t *stream, const char *data, apr_size_t *len)
 Write to a generic stream.

svn_error_tsvn_stream_close (svn_stream_t *stream)
 Close a generic stream.

svn_error_tsvn_stream_printf (svn_stream_t *stream, apr_pool_t *pool, const char *fmt,...)
 Write to stream using a printf-style fmt specifier, passed through apr_psprintf using memory from pool.

svn_error_tsvn_stream_readline (svn_stream_t *stream, svn_stringbuf_t **stringbuf, const char *eol, svn_boolean_t *eof, apr_pool_t *pool)
 Allocate *stringbuf in pool, and read into it one line (terminated by eol) from stream. More...

svn_error_tsvn_stream_copy (svn_stream_t *from, svn_stream_t *to, apr_pool_t *pool)
 
Since:
New in 1.1.
More...



Detailed Description

Generic byte-streams.


Typedef Documentation

typedef struct svn_stream_t svn_stream_t
 

An abstract stream of bytes--either incoming or outgoing or both.

The creator of a stream sets functions to handle read and write. Both of these handlers accept a baton whose value is determined at stream creation time; this baton can point to a structure containing data associated with the stream. If a caller attempts to invoke a handler which has not been set, it will generate a runtime assertion failure. The creator can also set a handler for close requests so that it can flush buffered data or whatever; if a close handler is not specified, a close request on the stream will simply be ignored. Note that svn_stream_close() does not deallocate the memory used to allocate the stream structure; free the pool you created the stream in to free that memory.

The read and write handlers accept length arguments via pointer. On entry to the handler, the pointed-to value should be the amount of data which can be read or the amount of data to write. When the handler returns, the value is reset to the amount of data actually read or written. Handlers are obliged to complete a read or write to the maximum extent possible; thus, a short read with no associated error implies the end of the input stream, and a short write should never occur without an associated error.

Definition at line 462 of file svn_io.h.


Function Documentation

svn_stream_t* svn_stream_compressed svn_stream_t   stream,
apr_pool_t *    pool
 

Return a stream that decompresses all data read and compresses all data written.

The stream stream is used to read and write all compressed data. All compression data structures are allocated on pool. If compression support is not compiled in then svn_stream_compressed() returns stream unmodified. Make sure you call svn_stream_close() on the stream returned by this function, so that all data are flushed and cleaned up.

svn_error_t* svn_stream_copy svn_stream_t   from,
svn_stream_t   to,
apr_pool_t *    pool
 

Since:
New in 1.1.

Read the contents of the readable stream from and write them to the writable stream to.

svn_error_t* svn_stream_for_stdout svn_stream_t **    out,
apr_pool_t *    pool
 

Set *out to a generic stream connected to stdout, allocated in pool.

The stream and its underlying APR handle will be closed when pool is cleared or destroyed.

svn_stream_t* svn_stream_from_aprfile apr_file_t *    file,
apr_pool_t *    pool
 

Convenience function for creating streams which operate on APR files.

For convenience, if file is NULL then svn_stream_empty(pool) is returned. Note that the stream returned by these operations is not considered to "own" the underlying file, meaning that svn_stream_close() on the stream will not close the file.

svn_stream_t* svn_stream_from_stringbuf svn_stringbuf_t   str,
apr_pool_t *    pool
 

Return a generic stream connected to stringbuf str.

Allocate the stream in pool.

svn_error_t* svn_stream_readline svn_stream_t   stream,
svn_stringbuf_t **    stringbuf,
const char *    eol,
svn_boolean_t *    eof,
apr_pool_t *    pool
 

Allocate *stringbuf in pool, and read into it one line (terminated by eol) from stream.

The line-terminator is read from the stream, but is not added to the end of the stringbuf. Instead, the stringbuf ends with a usual '\0'.

If stream runs out of bytes before encountering a line-terminator, then set *eof to TRUE, otherwise set *eof to FALSE.


Generated on Wed Aug 31 01:47:57 2005 for Subversion by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002