_txdelta_to_svndiff_stream(svn_txdelta_stream_t *txstream,
                              int svndiff_version,
                              int compression_level,
                              apr_pool_t *pool);

/** Return a writable generic stream which will parse svndiff-format
 * data into a text delta, invoking @a handler with @a handler_baton
 * whenever a new window is ready.
 *
 * When the caller closes this stream, this will signal completion to
 * the window handler by invoking @a handler once more, passing zero for
 * the @c window argument.
 *
 * If @a error_on_early_close is @c TRUE, then attempt to avoid
 * signaling completion to the window handler if the delta was
 * incomplete. Specifically, attempting to close the stream will be
 * successful only if the data written to the stream consisted of one or
 * more complete windows of svndiff data and no extra bytes. Otherwise,
 * closing the stream will not signal completion to the window handler,
 * and will return a #SVN_ERR_SVNDIFF_UNEXPECTED_END error. Note that if
 * no data at all was written, the delta is considered incomplete.
 *
 * If @a error_on_early_close is @c FALSE, closing the stream will
 * signal completion to the window handler, regardless of how much data
 * was written, and discard any pending incomplete data.
 *
 * Allocate the stream in @a pool.
 */
svn_stream_t *
svn_txdelta_parse_svndiff(svn_txdelta_window_handler_t handler,
                          void *handler_baton,
                          svn_boolean_t error_on_early_close,
                          apr_pool_t *pool);

/**
 * Read and parse one delta window in svndiff format from the
 * readable stream @a stream and place it in @a *window, allocating
 * the result in @a pool.  The caller must take responsibility for
 * stripping off the four-byte 'SVN@<ver@>' header at the beginning of
 * the svndiff document before reading the first window, and must
 * provide the version number (the value of the fourth byte) to each
 * invocation of this routine with the @a svndiff_version argument.
 *
 * @since New in 1.1.
 */
svn_error_t *
svn_txdelta_read_svndiff_window(svn_txdelta_window_t **window,
                                svn_stream_t *stream,
                                int svndiff_version,
                                apr_pool_t *pool);

/**
 * Read and skip one delta window in svndiff format from the
 * file @a file.  @a pool is used for temporary allocations.  The
 * caller must take responsibility for stripping off the four-byte
 * 'SVN@<ver@>' header at the beginning of the svndiff document before
 * reading or skipping the first window, and must provide the version
 * number (the value of the fourth byte) to each invocation of this
 * routine with the @a svndiff_version argument.
 *
 * @since New in 1.1.
 */
svn_error_t *
svn_txdelta_skip_svndiff_window(apr_file_t *file,
                                int svndiff_version,
                                apr_pool_t *pool);

/** @} */

