ObjFW  Diff

Differences From Artifact [4162b0edcc]:

To Artifact [0ba5d85fe3]:


27
28
29
30
31
32
33
34
35
36
37




38
39

40
41
42
43
44
45
46

47
48
49
50
51
52
53
27
28
29
30
31
32
33




34
35
36
37
38

39
40
41
42
43
44
45

46
47
48
49
50
51
52
53







-
-
-
-
+
+
+
+

-
+






-
+







 *
 * @brief A class for accessing and manipulating tar archives.
 */
OF_SUBCLASSING_RESTRICTED
@interface OFTarArchive: OFObject
{
	OFStream *_stream;
	enum {
		OF_TAR_ARCHIVE_MODE_READ,
		OF_TAR_ARCHIVE_MODE_WRITE,
		OF_TAR_ARCHIVE_MODE_APPEND
	enum OFTarArchiveMode {
		OFTarArchiveModeRead,
		OFTarArchiveModeWrite,
		OFTarArchiveModeAppend
	} _mode;
	of_string_encoding_t _encoding;
	OFStringEncoding _encoding;
	OFStream *_Nullable _lastReturnedStream;
}

/**
 * @brief The encoding to use for the archive. Defaults to UTF-8.
 */
@property (nonatomic) of_string_encoding_t encoding;
@property (nonatomic) OFStringEncoding encoding;

/**
 * @brief A stream for reading the current entry.
 *
 * @note This is only available in read mode.
 *
 * @note The returned stream conforms to @ref OFReadyForReadingObserving if the
61
62
63
64
65
66
67
68

69
70
71
72
73
74
75
76
77
78
79
80
81

82
83
84
85
86
87
88
89
61
62
63
64
65
66
67

68

69
70
71
72
73
74
75
76
77
78
79

80

81
82
83
84
85
86
87







-
+
-











-
+
-







 * @param stream A stream from which the tar archive will be read.
 *		 For append mode, this needs to be an OFSeekableStream.
 * @param mode The mode for the tar file. Valid modes are "r" for reading,
 *	       "w" for creating a new file and "a" for appending to an existing
 *	       archive.
 * @return A new, autoreleased OFTarArchive
 */
+ (instancetype)archiveWithStream: (OFStream *)stream
+ (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode;
			     mode: (OFString *)mode;

#ifdef OF_HAVE_FILES
/**
 * @brief Creates a new OFTarArchive object with the specified file.
 *
 * @param path The path to the tar archive
 * @param mode The mode for the tar file. Valid modes are "r" for reading,
 *	       "w" for creating a new file and "a" for appending to an existing
 *	       archive.
 * @return A new, autoreleased OFTarArchive
 */
+ (instancetype)archiveWithPath: (OFString *)path
+ (instancetype)archiveWithPath: (OFString *)path mode: (OFString *)mode;
			   mode: (OFString *)mode;
#endif

- (instancetype)init OF_UNAVAILABLE;

/**
 * @brief Initializes an already allocated OFTarArchive object with the
 *	  specified stream.
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
120
103
104
105
106
107
108
109

110

111
112
113
114
115
116
117







-
+
-







 *
 * @param path The path to the tar archive
 * @param mode The mode for the tar file. Valid modes are "r" for reading,
 *	       "w" for creating a new file and "a" for appending to an existing
 *	       archive.
 * @return An initialized OFTarArchive
 */
- (instancetype)initWithPath: (OFString *)path
- (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode;
			mode: (OFString *)mode;
#endif

/**
 * @brief Returns the next entry from the tar archive or `nil` if all entries
 *	  have been read.
 *
 * @note This is only available in read mode.