1ARCHIVE_READ_DATA(3)     BSD Library Functions Manual     ARCHIVE_READ_DATA(3)
2

NAME

4     archive_read_data, archive_read_data_block, archive_read_data_skip,
5     archive_read_data_into_fd — functions for reading streaming archives
6

LIBRARY

8     Streaming Archive Library (libarchive, -larchive)
9

SYNOPSIS

11     #include <archive.h>
12
13     la_ssize_t
14     archive_read_data(struct archive *, void *buff, size_t len);
15
16     int
17     archive_read_data_block(struct archive *, const void **buff, size_t *len,
18         off_t *offset);
19
20     int
21     archive_read_data_skip(struct archive *);
22
23     int
24     archive_read_data_into_fd(struct archive *, int fd);
25

DESCRIPTION

27     archive_read_data()
28             Read data associated with the header just read.  Internally, this
29             is a convenience function that calls archive_read_data_block()
30             and fills any gaps with nulls so that callers see a single con‐
31             tinuous stream of data.
32     archive_read_data_block()
33             Return the next available block of data for this entry.  Unlike
34             archive_read_data(), the archive_read_data_block() function
35             avoids copying data and allows you to correctly handle sparse
36             files, as supported by some archive formats.  The library guaran‐
37             tees that offsets will increase and that blocks will not overlap.
38             Note that the blocks returned from this function can be much
39             larger than the block size read from disk, due to compression and
40             internal buffer optimizations.
41     archive_read_data_skip()
42             A convenience function that repeatedly calls
43             archive_read_data_block() to skip all of the data for this ar‐
44             chive entry.  Note that this function is invoked automatically by
45             archive_read_next_header2() if the previous entry was not com‐
46             pletely consumed.
47     archive_read_data_into_fd()
48             A convenience function that repeatedly calls
49             archive_read_data_block() to copy the entire entry to the pro‐
50             vided file descriptor.
51

RETURN VALUES

53     Most functions return zero on success, non-zero on error.  The possible
54     return codes include: ARCHIVE_OK (the operation succeeded), ARCHIVE_WARN
55     (the operation succeeded but a non-critical error was encountered),
56     ARCHIVE_EOF (end-of-archive was encountered), ARCHIVE_RETRY (the opera‐
57     tion failed but can be retried), and ARCHIVE_FATAL (there was a fatal
58     error; the archive should be closed immediately).
59
60     archive_read_data() returns a count of bytes actually read or zero at the
61     end of the entry.  On error, a value of ARCHIVE_FATAL, ARCHIVE_WARN, or
62     ARCHIVE_RETRY is returned.
63

ERRORS

65     Detailed error codes and textual descriptions are available from the
66     archive_errno() and archive_error_string() functions.
67

SEE ALSO

69     tar(1), archive_read(3), archive_read_extract(3), archive_read_filter(3),
70     archive_read_format(3), archive_read_header(3), archive_read_open(3),
71     archive_read_set_options(3), archive_util(3), libarchive(3), tar(5)
72
73BSD                            February 2, 2012                            BSD
Impressum