@@ -20,8 +20,13 @@ public function __construct()
20
20
21
21
/**
22
22
* Attach a write handler.
23
- * The interface is exactly as fwrite. The handler is given a bytes-like object to write,
24
- * and should return the number of bytes written.
23
+ *
24
+ * The interface is similar to fwrite(). The handler is given a
25
+ * bytes-like object to write, and should return the number of bytes
26
+ * written.
27
+ *
28
+ * Unlike fwrite, you should return -1 on error.
29
+ *
25
30
* @throws Exception
26
31
*/
27
32
public function onWrite (callable $ callback ): void
@@ -31,10 +36,12 @@ public function onWrite(callable $callback): void
31
36
32
37
/**
33
38
* Attach a read handler.
34
- * The interface is similar to fread. The handler is given a number
39
+ *
40
+ * The interface is similar to fread(). The handler is given a number
35
41
* of bytes to fetch, and should return a bytes-like object containing up
36
42
* to that number of bytes. If there is no more data available, it should
37
43
* return null.
44
+ *
38
45
* Read handlers on VipsTarget are optional. If you do not set one, your
39
46
* target will be treated as unreadable and libvips will be unable to
40
47
* write some file types (just TIFF, as of the time of writing).
@@ -48,16 +55,19 @@ public function onRead(callable $callback): void
48
55
49
56
/**
50
57
* Attach a seek handler.
51
- * The interface is the same as fseek, so the handler is passed
58
+ *
59
+ * The interface is similar to fseek, so the handler is passed
52
60
* parameters for $offset and $whence with the same meanings.
53
61
* However, the handler MUST return the new seek position. A simple way
54
62
* to do this is to call ftell() and return that result.
63
+ *
55
64
* Seek handlers are optional. If you do not set one, your source will be
56
65
* treated as unseekable and libvips will do extra caching.
66
+ *
57
67
* $whence in particular:
58
- * 0 => start
59
- * 1 => current position
60
- * 2 => end
68
+ * - 0 => start
69
+ * - 1 => current position
70
+ * - 2 => end
61
71
*/
62
72
public function onSeek (callable $ callback ): void
63
73
{
@@ -68,9 +78,12 @@ public function onSeek(callable $callback): void
68
78
69
79
/**
70
80
* Attach an end handler.
81
+ *
71
82
* This optional handler is called at the end of write. It should do any
72
83
* cleaning up necessary, and return 0 on success and -1 on error.
73
- * Automatically falls back to onFinish if libvips <8.13
84
+ *
85
+ * Automatically falls back to onFinish if libvips <8.13.
86
+ *
74
87
* @throws Exception
75
88
*/
76
89
public function onEnd (callable $ callback ): void
@@ -84,8 +97,12 @@ public function onEnd(callable $callback): void
84
97
85
98
/**
86
99
* Attach a finish handler.
87
- * For libvips 8.13 and later, this method is deprecated in favour of @throws Exception
100
+ *
101
+ * For libvips 8.13 and later, this method is deprecated in favour of
102
+ * onEnd().
103
+ *
88
104
* @see TargetCustom::onEnd()
105
+ * @throws Exception
89
106
*/
90
107
public function onFinish (callable $ callback ): void
91
108
{
0 commit comments