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
 * Writer class for OutputStream objects.
22
 *
23
 * Unlike the Java counterpart, this class does not (yet) handle
24
 * character set transformations.  This will be an important function
25
 * of this class with move to supporting PHP6.
26
 *
27
 * @package phing.system.io
28
 */
29
class InputStreamReader extends Reader
30
{
31

32
    /**
33
     * @var InputStream
34
     */
35
    protected $inStream;
36

37
    /**
38
     * Construct a new InputStreamReader.
39
     *
40
     * @param    InputStream $inStream
41
     * @internal param $InputStream $$inStream InputStream to read from
42
     */
43 1
    public function __construct(InputStream $inStream)
44
    {
45 1
        $this->inStream = $inStream;
46
    }
47

48
    /**
49
     * Close the stream.
50
     * @throws IOException
51
     */
52 1
    public function close()
53
    {
54 1
        $this->inStream->close();
55
    }
56

57
    /**
58
     * Skip over $n bytes.
59
     *
60
     * @param  int $n
61
     * @return int
62
     */
63 0
    public function skip($n)
64
    {
65 0
        return $this->inStream->skip($n);
66
    }
67

68
    /**
69
     * Read data from file.
70
     *
71
     * @param  int $len Num chars to read.
72
     * @return mixed chars read or -1 if eof.
73
     */
74 1
    public function read($len = null)
75
    {
76 1
        return $this->inStream->read($len);
77
    }
78

79
    /**
80
     * Marks the current position in this input stream.
81
     *
82
     * @throws IOException - if the underlying stream doesn't support this method.
83
     */
84 0
    public function mark()
85
    {
86 0
        $this->inStream->mark();
87
    }
88

89
    /**
90
     * Whether the attached stream supports mark/reset.
91
     *
92
     * @return boolean
93
     */
94 0
    public function markSupported()
95
    {
96 0
        return $this->inStream->markSupported();
97
    }
98

99
    /**
100
     * Repositions this stream to the position at the time the mark method was last called on this input stream.
101
     *
102
     * @throws IOException - if the underlying stream doesn't support this method.
103
     */
104 0
    public function reset()
105
    {
106 0
        $this->inStream->reset();
107
    }
108

109
    /**
110
     * Whether eof has been reached with stream.
111
     *
112
     * @return boolean
113
     */
114 1
    public function eof()
115
    {
116 1
        return $this->inStream->eof();
117
    }
118

119
    /**
120
     * Returns string representation of attached stream.
121
     *
122
     * @return string
123
     */
124 1
    public function getResource()
125
    {
126 1
        return $this->inStream->__toString();
127
    }
128
}

Read our documentation on viewing source code .

Loading