-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathBinaryReader.php
More file actions
78 lines (63 loc) Β· 1.61 KB
/
BinaryReader.php
File metadata and controls
78 lines (63 loc) Β· 1.61 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
declare(strict_types=1);
namespace PHPJava\Kernel\Core;
use PHPJava\Core\Stream\Reader\ReaderInterface;
trait BinaryReader
{
/**
* @var ReaderInterface
*/
private $reader;
public function __construct(ReaderInterface $reader)
{
$this->reader = $reader;
}
final public function read(int $bytes = 1): string
{
return $this->reader->getReader()->read($bytes);
}
public function readByte(): int
{
return $this->reader->getReader()->readByte();
}
public function readUnsignedByte(): int
{
return $this->reader->getReader()->readUnsignedByte();
}
public function readUnsignedInt(): int
{
return $this->reader->getReader()->readUnsignedInt();
}
public function readUnsignedShort(): int
{
return $this->reader->getReader()->readUnsignedShort();
}
public function readInt(): int
{
return $this->reader->getReader()->readInt();
}
public function readShort(): int
{
return $this->reader->getReader()->readShort();
}
public function readUnsignedLong(): int
{
return $this->reader->getReader()->readUnsignedLong();
}
public function readLong(): int
{
return $this->reader->getReader()->readLong();
}
public function seek($bytes): void
{
$this->reader->getReader()->seek($bytes);
}
public function setOffset($pointer): void
{
$this->reader->getReader()->setOffset($pointer);
}
public function getOffset(): int
{
return $this->reader->getReader()->getOffset();
}
}