|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
5
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
6
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
7
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
8
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
9
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
10
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
11
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
12
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
13
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
14
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
15
|
|
|
* |
|
16
|
|
|
* This software consists of voluntary contributions made by many individuals |
|
17
|
|
|
* and is licensed under the LGPL. For more information please see |
|
18
|
|
|
* <http://phing.info>. |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace Phing\Io; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Abstract class for reading character streams. |
|
25
|
|
|
* |
|
26
|
|
|
* @author Hans Lellelid <[email protected]> |
|
27
|
|
|
* @author Yannick Lecaillez <[email protected]> |
|
28
|
|
|
*/ |
|
29
|
|
|
abstract class Reader |
|
30
|
|
|
{ |
|
31
|
|
|
/** |
|
32
|
|
|
* Read data from source. |
|
33
|
|
|
* |
|
34
|
|
|
* If length is specified, then only that number of chars is read, |
|
35
|
|
|
* otherwise stream is read until EOF. |
|
36
|
|
|
* |
|
37
|
|
|
* @param int $len |
|
38
|
|
|
* |
|
39
|
|
|
* @throws IOException |
|
40
|
|
|
*/ |
|
41
|
|
|
abstract public function read($len = null); |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Close stream. |
|
45
|
|
|
* |
|
46
|
|
|
* @throws IOException if there is an error closing stream |
|
47
|
|
|
*/ |
|
48
|
|
|
abstract public function close(); |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Returns the filename, url, etc. that is being read from. |
|
52
|
|
|
* This is critical for, e.g., ExpatParser's ability to know |
|
53
|
|
|
* the filename that is throwing an ExpatParserException, etc. |
|
54
|
|
|
* |
|
55
|
|
|
* @return string |
|
56
|
|
|
*/ |
|
57
|
|
|
abstract public function getResource(); |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Move stream position relative to current pos. |
|
61
|
|
|
* |
|
62
|
|
|
* @param int $n |
|
63
|
|
|
*/ |
|
64
|
|
|
public function skip($n) |
|
|
|
|
|
|
65
|
|
|
{ |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Reset the current position in stream to beginning or last mark (if supported). |
|
70
|
|
|
*/ |
|
71
|
|
|
public function reset() |
|
72
|
|
|
{ |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* If supported, places a "marker" (like a bookmark) at current stream position. |
|
77
|
|
|
* A subsequent call to reset() will move stream position back |
|
78
|
|
|
* to last marker (if supported). |
|
79
|
|
|
*/ |
|
80
|
|
|
public function mark() |
|
81
|
|
|
{ |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Whether marking is supported. |
|
86
|
|
|
* |
|
87
|
|
|
* @return bool |
|
88
|
|
|
*/ |
|
89
|
|
|
public function markSupported() |
|
90
|
|
|
{ |
|
91
|
|
|
return false; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Is stream ready for reading. |
|
96
|
|
|
* |
|
97
|
|
|
* @return bool |
|
98
|
|
|
*/ |
|
99
|
|
|
public function ready() |
|
100
|
|
|
{ |
|
101
|
|
|
return true; |
|
102
|
|
|
} |
|
103
|
|
|
} |
|
104
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.