Imported Upstream version 3.4.1
[platform/upstream/libarchive.git] / doc / wiki / ManPageArchiveReadData3.wiki
1 ARCHIVE_READ_DATA(3) manual page 
2 == NAME == 
3 '''archive_read_data''', 
4 '''archive_read_data_block''', 
5 '''archive_read_data_skip''', 
6 '''archive_read_data_into_fd''' 
7 - functions for reading streaming archives 
8 == LIBRARY == 
9 Streaming Archive Library (libarchive, -larchive) 
10 == SYNOPSIS == 
11 '''<nowiki>#include <archive.h></nowiki>''' 
12 <br> 
13 ''la_ssize_t'' 
14 <br> 
15 '''archive_read_data'''(''struct archive *'', ''void *buff'', ''size_t len''); 
16 <br> 
17 ''int'' 
18 <br> 
19 '''archive_read_data_block'''(''struct archive *'', ''const void **buff'', ''size_t *len'', ''off_t *offset''); 
20 <br> 
21 ''int'' 
22 <br> 
23 '''archive_read_data_skip'''(''struct archive *''); 
24 <br> 
25 ''int'' 
26 <br> 
27 '''archive_read_data_into_fd'''(''struct archive *'', ''int fd''); 
28 == DESCRIPTION == 
29 <dl> 
30 <dt>'''archive_read_data'''()</dt><dd> 
31 Read data associated with the header just read. 
32 Internally, this is a convenience function that calls 
33 '''archive_read_data_block'''() 
34 and fills any gaps with nulls so that callers see a single 
35 continuous stream of data. 
36 </dd><dt>'''archive_read_data_block'''()</dt><dd> 
37 Return the next available block of data for this entry. 
38 Unlike 
39 '''archive_read_data'''(), 
40 the 
41 '''archive_read_data_block'''() 
42 function avoids copying data and allows you to correctly handle 
43 sparse files, as supported by some archive formats. 
44 The library guarantees that offsets will increase and that blocks 
45 will not overlap. 
46 Note that the blocks returned from this function can be much larger 
47 than the block size read from disk, due to compression 
48 and internal buffer optimizations. 
49 </dd><dt>'''archive_read_data_skip'''()</dt><dd> 
50 A convenience function that repeatedly calls 
51 '''archive_read_data_block'''() 
52 to skip all of the data for this archive entry. 
53 Note that this function is invoked automatically by 
54 '''archive_read_next_header2'''() 
55 if the previous entry was not completely consumed. 
56 </dd><dt>'''archive_read_data_into_fd'''()</dt><dd> 
57 A convenience function that repeatedly calls 
58 '''archive_read_data_block'''() 
59 to copy the entire entry to the provided file descriptor. 
60 </dd></dl> 
61 == RETURN VALUES == 
62 Most functions return zero on success, non-zero on error. 
63 The possible return codes include: 
64 '''ARCHIVE_OK''' 
65 (the operation succeeded), 
66 '''ARCHIVE_WARN''' 
67 (the operation succeeded but a non-critical error was encountered), 
68 '''ARCHIVE_EOF''' 
69 (end-of-archive was encountered), 
70 '''ARCHIVE_RETRY''' 
71 (the operation failed but can be retried), 
72 and 
73 '''ARCHIVE_FATAL''' 
74 (there was a fatal error; the archive should be closed immediately). 
75
76 '''archive_read_data'''() 
77 returns a count of bytes actually read or zero at the end of the entry. 
78 On error, a value of 
79 '''ARCHIVE_FATAL''', 
80 '''ARCHIVE_WARN''', 
81 or 
82 '''ARCHIVE_RETRY''' 
83 is returned. 
84 == ERRORS == 
85 Detailed error codes and textual descriptions are available from the 
86 '''archive_errno'''() 
87 and 
88 '''archive_error_string'''() 
89 functions. 
90 == SEE ALSO == 
91 [[ManPageBsdtar1]], 
92 [[ManPagerchiveead3]], 
93 [[ManPagerchiveeadxtract3]], 
94 [[ManPagerchiveeadilter3]], 
95 [[ManPagerchiveeadormat3]], 
96 [[ManPagerchiveeadeader3]], 
97 [[ManPagerchiveeadpen3]], 
98 [[ManPagerchiveeadetptions3]], 
99 [[ManPagerchivetil3]], 
100 [[ManPageibarchive3]], 
101 [[ManPageTar5]]