4 * PEL: PHP Exif Library.
5 * A library with support for reading and
6 * writing all Exif headers in JPEG and TIFF images using PHP.
8 * Copyright (C) 2004, 2005, 2006, 2007 Martin Geisler.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program in the file COPYING; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
25 namespace lsolesen\pel;
28 * Classes used to hold bytes, both signed and unsigned.
30 * PelEntryWindowsString} class is used to manipulate strings in the
31 * format Windows XP needs.
33 * @author Martin Geisler <mgeisler@users.sourceforge.net>
34 * @license http://www.gnu.org/licenses/gpl.html GNU General Public
40 * Class for holding unsigned bytes.
42 * This class can hold bytes, either just a single byte or an array of
43 * bytes. The class will be used to manipulate any of the Exif tags
44 * which has format {@link PelFormat::BYTE}.
46 * @author Martin Geisler <mgeisler@users.sourceforge.net>
49 class PelEntryByte extends PelEntryNumber
53 * Make a new entry that can hold an unsigned byte.
55 * The method accept several integer arguments. The {@link
56 * getValue} method will always return an array except for when a
57 * single integer argument is given here.
60 * the tag which this entry represents. This
61 * should be one of the constants defined in {@link PelTag}
62 * which has format {@link PelFormat::BYTE}.
64 * @param int $value...
65 * the byte(s) that this entry will represent.
66 * The argument passed must obey the same rules as the argument to
67 * {@link setValue}, namely that it should be within range of an
68 * unsigned byte, that is between 0 and 255 (inclusive). If not,
69 * then a {@link PelOverflowException} will be thrown.
71 public function __construct($tag, $value = null)
76 $this->format = PelFormat::BYTE;
78 $value = func_get_args();
80 $this->setValueArray($value);
84 * Convert a number into bytes.
87 * the number that should be converted.
89 * @param PelByteOrder $order
90 * one of {@link PelConvert::LITTLE_ENDIAN} and
91 * {@link PelConvert::BIG_ENDIAN}, specifying the target byte order.
93 * @return string bytes representing the number given.
95 public function numberToBytes($number, $order)