ObjFW
OFTarArchive.h
1 /*
2  * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFObject.h"
17 #import "OFKernelEventObserver.h"
18 #import "OFString.h"
19 #import "OFTarArchiveEntry.h"
20 
21 OF_ASSUME_NONNULL_BEGIN
22 
23 @class OFIRI;
24 @class OFStream;
25 
31 OF_SUBCLASSING_RESTRICTED
33 {
34  OFStream *_stream;
35  uint_least8_t _mode;
36  OFStringEncoding _encoding;
37  OFTarArchiveEntry *_Nullable _currentEntry;
38 #ifdef OF_TAR_ARCHIVE_M
39 @public
40 #endif
41  OFStream *_Nullable _lastReturnedStream;
42 }
43 
47 @property (nonatomic) OFStringEncoding encoding;
48 
62 + (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode;
63 
76 + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
77 
87 + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI;
88 
89 - (instancetype)init OF_UNAVAILABLE;
90 
105 - (instancetype)initWithStream: (OFStream *)stream
106  mode: (OFString *)mode OF_DESIGNATED_INITIALIZER;
107 
121 - (instancetype)initWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
122 
139 - (nullable OFTarArchiveEntry *)nextEntry;
140 
151 - (OFStream *)streamForReadingCurrentEntry;
152 
170 - (OFStream *)streamForWritingEntry: (OFTarArchiveEntry *)entry;
171 
177 - (void)close;
178 @end
179 
180 OF_ASSUME_NONNULL_END
OFStringEncoding
The encoding of a string.
Definition: OFString.h:61
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:37
The root class for all other classes inside ObjFW.
Definition: OFObject.h:688
A base class for different types of streams.
Definition: OFStream.h:188
A class for handling strings.
Definition: OFString.h:135
A class which represents an entry of a tar archive.
Definition: OFTarArchiveEntry.h:56
A class for accessing and manipulating tar archives.
Definition: OFTarArchive.h:33