ManPageArchiveReadData3.wiki 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. '''archive_read_data'''()
  76. returns a count of bytes actually read or zero at the end of the entry.
  77. On error, a value of
  78. '''ARCHIVE_FATAL''',
  79. '''ARCHIVE_WARN''',
  80. or
  81. '''ARCHIVE_RETRY'''
  82. is returned.
  83. == ERRORS ==
  84. Detailed error codes and textual descriptions are available from the
  85. '''archive_errno'''()
  86. and
  87. '''archive_error_string'''()
  88. functions.
  89. == SEE ALSO ==
  90. [[ManPageBsdtar1]],
  91. [[ManPageArchiveRead3]],
  92. [[ManPageArchiveReadExtract3]],
  93. [[ManPageArchiveReadFilter3]],
  94. [[ManPageArchiveReadFormat3]],
  95. [[ManPageArchiveReadHeader3]],
  96. [[ManPageArchiveReadOpen3]],
  97. [[ManPageArchiveReadSetOptions3]],
  98. [[ManPageArchiveUtil3]],
  99. [[ManPageLibarchive3]],
  100. [[ManPageTar5]]