/adei/ui

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/ui

« back to all changes in this revision

Viewing changes to classes/stream/streamfilewriter.php

  • Committer: Suren A. Chilingaryan
  • Date: 2008-04-02 10:23:22 UTC
  • Revision ID: csa@dside.dyndns.org-20080402102322-okib92sicg2dx3o3
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
class STREAMFileWriter extends STREAMHandler implements STREAMSequenceInterface, STREAMWriterInterface {
 
4
 var $filename;
 
5
 
 
6
 function __construct(IO $object, STREAMHandler $next = NULL, $flags = 0) {
 
7
    if (!$object->output)
 
8
        $this->filename = false;
 
9
    elseif (is_string($object->output)) {
 
10
        $this->filename = $object->output;
 
11
    } else
 
12
        throw new ADEIException(translate("Invalid IO object is passed to the constructor of STREAMFilemodeConverter. Could not guess output file name."));
 
13
 
 
14
    parent::__construct($object, $next, $flags);
 
15
 }
 
16
 
 
17
 function Start(&$args = NULL) {
 
18
    parent::Start($args);
 
19
 
 
20
    if ($this->object->output)
 
21
        $this->object->Open();
 
22
    else {
 
23
        if (($args)&&($args['extension']))
 
24
            $this->filename = GetTmpFile("adei_stream_filewriter_", $args['extension']);
 
25
        else
 
26
            $this->filename = GetTmpFile("adei_stream_filewriter_");
 
27
        
 
28
        $this->object->Open($this->filename);
 
29
    }
 
30
 }
 
31
 
 
32
 function End() {
 
33
    $this->object->Close();
 
34
    $this->next->WriteData($this->filename);
 
35
    parent::End();
 
36
 }
 
37
}
 
38
 
 
39
 
 
40
?>
 
 
b'\\ No newline at end of file'