Welcome to mirror list, hosted at ThFree Co, Russian Federation.

JarMarkerExtraField.php « Fields « Extra « PhpZip « src « zip « nelexa « vendor - github.com/CarnetApp/CarnetNextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4558408bd71e7349f26fee47327292df5ab27f13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
<?php

namespace PhpZip\Extra\Fields;

use PhpZip\Exception\ZipException;
use PhpZip\Extra\ExtraField;

/**
 * Jar Marker Extra Field
 * An executable Java program can be packaged in a JAR file with all the libraries it uses.
 * Executable JAR files can easily be distinguished from the files packed in the JAR file
 * by the extra field in the first file, which is hexadecimal in the 0xCAFE bytes series.
 *
 * @author Ne-Lexa alexey@nelexa.ru
 * @license MIT
 */
class JarMarkerExtraField implements ExtraField
{
    /**
     * Returns the Header ID (type) of this Extra Field.
     * The Header ID is an unsigned short integer (two bytes)
     * which must be constant during the life cycle of this object.
     *
     * @return int
     */
    public static function getHeaderId()
    {
        return 0xCAFE;
    }

    /**
     * Serializes a Data Block.
     * @return string
     */
    public function serialize()
    {
        return '';
    }

    /**
     * Initializes this Extra Field by deserializing a Data Block.
     * @param string $data
     * @throws ZipException
     */
    public function deserialize($data)
    {
        if (0 !== strlen($data)) {
            throw new ZipException("JarMarker doesn't expect any data");
        }
    }
}