@@ -20,8 +20,13 @@ public function __construct()
2020
2121 /** 
2222 * 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+  * 
2530 * @throws Exception 
2631 */ 
2732 public  function  onWrite (callable  $ callback ): void 
@@ -31,10 +36,12 @@ public function onWrite(callable $callback): void
3136
3237 /** 
3338 * 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 
3541 * of bytes to fetch, and should return a bytes-like object containing up 
3642 * to that number of bytes. If there is no more data available, it should 
3743 * return null. 
44+  * 
3845 * Read handlers on VipsTarget are optional. If you do not set one, your 
3946 * target will be treated as unreadable and libvips will be unable to 
4047 * write some file types (just TIFF, as of the time of writing). 
@@ -48,16 +55,19 @@ public function onRead(callable $callback): void
4855
4956 /** 
5057 * 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 
5260 * parameters for $offset and $whence with the same meanings. 
5361 * However, the handler MUST return the new seek position. A simple way 
5462 * to do this is to call ftell() and return that result. 
63+  * 
5564 * Seek handlers are optional. If you do not set one, your source will be 
5665 * treated as unseekable and libvips will do extra caching. 
66+  * 
5767 * $whence in particular: 
58-  * 0 => start 
59-  * 1 => current position 
60-  * 2 => end 
68+  * -  0 => start 
69+  * -  1 => current position 
70+  * -  2 => end 
6171 */ 
6272 public  function  onSeek (callable  $ callback ): void 
6373 {
@@ -68,9 +78,12 @@ public function onSeek(callable $callback): void
6878
6979 /** 
7080 * Attach an end handler. 
81+  * 
7182 * This optional handler is called at the end of write. It should do any 
7283 * 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+  * 
7487 * @throws Exception 
7588 */ 
7689 public  function  onEnd (callable  $ callback ): void 
@@ -84,8 +97,12 @@ public function onEnd(callable $callback): void
8497
8598 /** 
8699 * 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+  * 
88104 * @see TargetCustom::onEnd() 
105+  * @throws Exception 
89106 */ 
90107 public  function  onFinish (callable  $ callback ): void 
91108 {
0 commit comments