Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace OpenSpout\Writer;
6
 
7
use OpenSpout\Common\Entity\Row;
8
use OpenSpout\Common\Exception\InvalidArgumentException;
9
use OpenSpout\Common\Exception\IOException;
10
 
11
interface WriterInterface
12
{
13
    /**
14
     * Initializes the writer and opens it to accept data.
15
     * By using this method, the data will be written to a file.
16
     *
17
     * @param string $outputFilePath Path of the output file that will contain the data
18
     *
19
     * @throws IOException If the writer cannot be opened or if the given path is not writable
20
     */
21
    public function openToFile(string $outputFilePath): void;
22
 
23
    /**
24
     * Initializes the writer and opens it to accept data.
25
     * By using this method, the data will be outputted directly to the browser.
26
     *
27
     * @param string $outputFileName Name of the output file that will contain the data. If a path is passed in, only the file name will be kept
28
     *
29
     * @throws IOException If the writer cannot be opened
30
     */
31
    public function openToBrowser(string $outputFileName): void;
32
 
33
    /**
34
     * Appends a row to the end of the stream.
35
     *
36
     * @param Row $row The row to be appended to the stream
37
     *
38
     * @throws Exception\WriterNotOpenedException If the writer has not been opened yet
39
     * @throws IOException                        If unable to write data
40
     */
41
    public function addRow(Row $row): void;
42
 
43
    /**
44
     * Appends the rows to the end of the stream.
45
     *
46
     * @param Row[] $rows The rows to be appended to the stream
47
     *
48
     * @throws InvalidArgumentException           If the input param is not valid
49
     * @throws Exception\WriterNotOpenedException If the writer has not been opened yet
50
     * @throws IOException                        If unable to write data
51
     */
52
    public function addRows(array $rows): void;
53
 
54
    /**
55
     * Set document creator.
56
     *
57
     * @param string $creator document creator
58
     */
59
    public function setCreator(string $creator): void;
60
 
61
    /**
62
     * @return 0|positive-int
63
     */
64
    public function getWrittenRowCount(): int;
65
 
66
    /**
67
     * Closes the writer. This will close the streamer as well, preventing new data
68
     * to be written to the file.
69
     */
70
    public function close(): void;
71
}