classes/phing/system/io/BufferedReader.php
public function read($len = null)
    {

        // if $len is specified, we'll use that; otherwise, use the configured buffer size.
        if ($len === null) {
            $len = $this->bufferSize;
        }

        if (($data = $this->in->read($len)) !== -1) {
            // not all files end with a newline character, so we also need to check EOF
            if (!$this->in->eof()) {
                $notValidPart = strrchr($data, "\n");
                $notValidPartSize = strlen($notValidPart);

                if ($notValidPartSize > 1) {
                    // Block doesn't finish on a EOL
                    // Find the last EOL and forget all following stuff
                    $dataSize = strlen($data);
                    $validSize = $dataSize - $notValidPartSize + 1;

                    $data = substr($data, 0, $validSize);

                    // Rewind to the beginning of the forgotten stuff.
                    $this->in->skip(-$notValidPartSize + 1);
                }
            } // if !EOF
        }

        return $data;
    }
public function read($len = null)
    {

        // if $len is specified, we'll use that; otherwise, use the configured buffer size.
        if ($len === null) {
            $len = $this->bufferSize;
        }

        if (($data = $this->in->read($len)) !== -1) {
            // not all files end with a newline character, so we also need to check EOF
            if (!$this->in->eof()) {
                $notValidPart = strrchr($data, "\n");
                $notValidPartSize = strlen($notValidPart);

                if ($notValidPartSize > 1) {
                    // Block doesn't finish on a EOL
                    // Find the last EOL and forget all following stuff
                    $dataSize = strlen($data);
                    $validSize = $dataSize - $notValidPartSize + 1;

                    $data = substr($data, 0, $validSize);

                    // Rewind to the beginning of the forgotten stuff.
                    $this->in->skip(-$notValidPartSize + 1);
                }
            } // if !EOF
        }

        return $data;
    }
public function read ( $ len = null ) { // if $len is specified, we'll use that; otherwise, use the configured buffer size. if ( $ len === null ) { $ len = $ this -> bufferSize ; } if ( ( $ data = $ this -> in -> read ( $ len ) ) !== - 1 ) { // not all files end with a newline character, so we also need to check EOF if ( ! $ this -> in -> eof ( ) ) { $ notValidPart = strrchr ( $ data , "\n" ) ; $ notValidPartSize = strlen ( $ notValidPart ) ; if ( $ notValidPartSize > 1 ) { // Block doesn't finish on a EOL // Find the last EOL and forget all following stuff $ dataSize = strlen ( $ data ) ; $ validSize = $ dataSize - $ notValidPartSize + 1 ; $ data = substr ( $ data , 0 , $ validSize ) ; // Rewind to the beginning of the forgotten stuff. $ this -> in -> skip ( - $ notValidPartSize + 1 ) ; } } // if !EOF } return $ data ; }
Reads and returns a chunk of data.

@param  int $len Number of bytes to read.  Default is to read configured buffer size number of bytes.
@return mixed buffer or -1 if EOF.
Reads and returns a chunk of data .