/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

class STREAMOutput extends STREAMHandler implements STREAMSequenceInterface, STREAMWriterInterface {
 var $count;
 
 function __construct($object = NULL, STREAMHandler $next = NULL, $flags = 0) {
    if (is_object($object)) {
	if ((!$object)||($object instanceof STREAMObjectInterface))
	    parent::__construct($object, $next, $flags);
	else
	    throw new ADEIException(translate("Argument 1 passed to STREAMOutput constructor must implement STREAMObjectInterface, the '%s' is supplied", get_class($object)));
    } else
	parent::__construct(new IO($object), $next, $flags);
 }

 function SequenceStart(&$args = NULL) {
    if (($args)&&($args['expected_blocks'] > 1))
	throw new ADEIException(translate("Invalid STREAM. The multiple groups are not supported by STREAMOutput"));

    $this->count = 0;

    parent::SequenceStart($args);
 }
 
 function Start(&$args = NULL) {
    if ($this->count++)
	throw new ADEIException(translate("Invalid STREAM. The multiple groups are not supported by STREAMOutput"));

    parent::Start($args);

    $this->object->Open();
 }

 function End() {
    $this->object->Close();

    parent::End();
 }
}


?>