ObjFW
OFTarArchive.h
1 /*
2  * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License version 3.0 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * version 3.0 for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * version 3.0 along with this program. If not, see
17  * <https://www.gnu.org/licenses/>.
18  */
19 
20 #import "OFObject.h"
21 #import "OFString.h"
22 #import "OFTarArchiveEntry.h"
23 
24 OF_ASSUME_NONNULL_BEGIN
25 
26 @class OFIRI;
27 @class OFStream;
28 
34 OF_SUBCLASSING_RESTRICTED
36 {
37  OFStream *_stream;
38  uint_least8_t _mode;
39  OFStringEncoding _encoding;
40  OFTarArchiveEntry *_Nullable _currentEntry;
41 #ifdef OF_TAR_ARCHIVE_M
42 @public
43 #endif
44  OFStream *_Nullable _lastReturnedStream;
45 }
46 
50 @property (nonatomic) OFStringEncoding encoding;
51 
65 + (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode;
66 
79 + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
80 
90 + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI;
91 
92 - (instancetype)init OF_UNAVAILABLE;
93 
108 - (instancetype)initWithStream: (OFStream *)stream
109  mode: (OFString *)mode OF_DESIGNATED_INITIALIZER;
110 
124 - (instancetype)initWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
125 
142 - (nullable OFTarArchiveEntry *)nextEntry;
143 
154 - (OFStream *)streamForReadingCurrentEntry;
155 
173 - (OFStream *)streamForWritingEntry: (OFTarArchiveEntry *)entry;
174 
180 - (void)close;
181 @end
182 
183 OF_ASSUME_NONNULL_END
OFStringEncoding
The encoding of a string.
Definition: OFString.h:65
The root class for all other classes inside ObjFW.
Definition: OFObject.h:690
A class which represents an entry of a tar archive.
Definition: OFTarArchiveEntry.h:57
A base class for different types of streams.
Definition: OFStream.h:278
A class for handling strings.
Definition: OFString.h:142
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:39
A class for accessing and manipulating tar archives.
Definition: OFTarArchive.h:35