ObjFW
Loading...
Searching...
No Matches
OFGZIPStream.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 "OFStream.h"
17#import "OFDate.h"
18
19@class OFInflateStream;
20
21OF_ASSUME_NONNULL_BEGIN
22
26typedef enum {
27 OFGZIPStreamOperatingSystemFAT = 0,
28 OFGZIPStreamOperatingSystemAmiga = 1,
29 OFGZIPStreamOperatingSystemVMS = 2,
30 OFGZIPStreamOperatingSystemUNIX = 3,
31 OFGZIPStreamOperatingSystemVM_CMS = 4,
32 OFGZIPStreamOperatingSystemAtariTOS = 5,
33 OFGZIPStreamOperatingSystemHPFS = 6,
34 OFGZIPStreamOperatingSystemMacintosh = 7,
35 OFGZIPStreamOperatingSystemZSystem = 8,
36 OFGZIPStreamOperatingSystemCPM = 9,
37 OFGZIPStreamOperatingSystemTOPS20 = 10,
38 OFGZIPStreamOperatingSystemNTFS = 11,
39 OFGZIPStreamOperatingSystemQDO = 12,
40 OFGZIPStreamOperatingSystemAcornRISCOS = 13,
41 OFGZIPStreamOperatingSystemUnknown = 255
42} OFGZIPStreamOperatingSystem;
43
50OF_SUBCLASSING_RESTRICTED
52{
53 OFStream *_stream;
54 OFInflateStream *_Nullable _inflateStream;
55 enum {
56 OFGZIPStreamStateID1,
57 OFGZIPStreamStateID2,
58 OFGZIPStreamStateCompressionMethod,
59 OFGZIPStreamStateFlags,
60 OFGZIPStreamStateModificationDate,
61 OFGZIPStreamStateExtraFlags,
62 OFGZIPStreamStateOperatingSystem,
63 OFGZIPStreamStateExtraLength,
64 OFGZIPStreamStateExtra,
65 OFGZIPStreamStateName,
66 OFGZIPStreamStateComment,
67 OFGZIPStreamStateHeaderCRC16,
68 OFGZIPStreamStateData,
69 OFGZIPStreamStateCRC32,
70 OFGZIPStreamStateUncompressedSize
71 } _state;
72 enum {
73 OFGZIPStreamFlagText = 0x01,
74 OFGZIPStreamFlagHeaderCRC16 = 0x02,
75 OFGZIPStreamFlagExtra = 0x04,
76 OFGZIPStreamFlagName = 0x08,
77 OFGZIPStreamFlagComment = 0x10
78 } _flags;
79 uint8_t _extraFlags;
80 OFGZIPStreamOperatingSystem _operatingSystemMadeOn;
81 size_t _bytesRead;
82 uint8_t _buffer[4];
83 OFDate *_Nullable _modificationDate;
84 uint16_t _extraLength;
85 uint32_t _CRC32, _uncompressedSize;
86}
87
94@property (readonly, nonatomic)
95 OFGZIPStreamOperatingSystem operatingSystemMadeOn;
96
103@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFDate *modificationDate;
104
113+ (instancetype)streamWithStream: (OFStream *)stream mode: (OFString *)mode;
114
115- (instancetype)init OF_UNAVAILABLE;
116
126- (instancetype)initWithStream: (OFStream *)stream
127 mode: (OFString *)mode OF_DESIGNATED_INITIALIZER;
128@end
129
130OF_ASSUME_NONNULL_END
A class for storing, accessing and comparing dates.
Definition OFDate.h:30
A class that handles GZIP compression and decompression transparently for an underlying stream.
Definition OFGZIPStream.h:52
OFDate * modificationDate
The modification date of the original file.
Definition OFGZIPStream.h:103
A class that handles Deflate decompression transparently for an underlying stream.
Definition OFInflateStream.h:35
A base class for different types of streams.
Definition OFStream.h:188
A class for handling strings.
Definition OFString.h:135