ObjFW
OFTarArchive.h
1 /*
2  * Copyright (c) 2008-2026 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 OFMutableDictionary OF_GENERIC(KeyType, ObjectType);
28 @class OFStream;
29 
35 OF_SUBCLASSING_RESTRICTED
37 {
38  OFStream *_stream;
39  uint_least8_t _mode;
40  OFStringEncoding _encoding;
41  OFMutableDictionary *_globalExtendedHeader;
42  OFTarArchiveEntry *_Nullable _currentEntry;
43 #ifdef OF_TAR_ARCHIVE_M
44 @public
45 #endif
46  OFStream *_Nullable _lastReturnedStream;
47 }
48 
52 @property (nonatomic) OFStringEncoding encoding;
53 
67 + (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode;
68 
81 + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
82 
92 + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI;
93 
94 - (instancetype)init OF_UNAVAILABLE;
95 
110 - (instancetype)initWithStream: (OFStream *)stream
111  mode: (OFString *)mode OF_DESIGNATED_INITIALIZER;
112 
126 - (instancetype)initWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
127 
144 - (nullable OFTarArchiveEntry *)nextEntry;
145 
156 - (OFStream *)streamForReadingCurrentEntry;
157 
175 - (OFStream *)streamForWritingEntry: (OFTarArchiveEntry *)entry;
176 
182 - (void)close;
183 @end
184 
185 OF_ASSUME_NONNULL_END
OFStringEncoding
The encoding of a string.
Definition: OFString.h:65
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:41
An abstract class for storing and changing objects in a dictionary.
Definition: OFMutableDictionary.h:48
The root class for all other classes inside ObjFW.
Definition: OFObject.h:956
A base class for different types of streams.
Definition: OFStream.h:280
A class for handling strings.
Definition: OFString.h:143
A class which represents an entry of a tar archive.
Definition: OFTarArchiveEntry.h:134
A class for accessing and manipulating tar archives.
Definition: OFTarArchive.h:37