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