Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/*
3
 *  $Id: FileWriter.php 123 2006-09-14 20:19:08Z mrook $
4
 *
5
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16
 *
17
 * This software consists of voluntary contributions made by many individuals
18
 * and is licensed under the LGPL. For more information please see
19
 * <http://phing.info>.
20
 */
21
 
22
include_once 'phing/system/io/PhingFile.php';
23
require_once 'phing/system/io/Writer.php';
24
 
25
/**
26
 * Writer class for OutputStream objects.
27
 *
28
 * Unlike the Java counterpart, this class does not (yet) handle
29
 * character set transformations.  This will be an important function
30
 * of this class with move to supporting PHP6.
31
 *
32
 * @package   phing.system.io
33
 */
34
class OutputStreamWriter extends Writer {
35
 
36
	/**
37
	 * @var OutputStream
38
	 */
39
    protected $outStream;
40
 
41
    /**
42
     * Construct a new OutputStreamWriter.
43
     * @param OutputStream $outStream OutputStream to write to
44
     */
45
    public function __construct(OutputStream $outStream) {
46
        $this->outStream = $outStream;
47
    }
48
 
49
    /**
50
     * Close the stream.
51
     */
52
    public function close() {
53
    	return $this->outStream->close();
54
    }
55
 
56
    /**
57
     * Write char data to stream.
58
     *
59
     * @param unknown_type $buf
60
     * @param unknown_type $off
61
     * @param unknown_type $len
62
     * @return unknown
63
     */
64
    public function write($buf, $off = null, $len = null) {
65
    	return $this->outStream->write($buf, $off, $len);
66
    }
67
 
68
    /**
69
     * Flush output to the stream.
70
     */
71
	public function flush() {
72
    	$this->outStream->flush();
73
    }
74
 
75
    /**
76
     * Gets a string representation of attached stream resource.
77
     *
78
     * @return string String representation of output stream
79
     */
80
    public function getResource() {
81
    	return $this->outStream->__toString();
82
    }
83
}
84