… | |
… | |
115 | |
115 | |
116 | Set the eof flag to true. This indicates that no data is following the current input scalar. |
116 | Set the eof flag to true. This indicates that no data is following the current input scalar. |
117 | |
117 | |
118 | =item $buffers->avail_in |
118 | =item $buffers->avail_in |
119 | |
119 | |
120 | Returns the numer of bytes still available for input. |
120 | Returns the numer of bytes still available for input. If there are no |
|
|
121 | input bytes available but the eof flag is set, returns -1 (to make boolean |
|
|
122 | tests easy to check wether to supply more data easier). |
121 | |
123 | |
122 | =item $buffers->avail_out |
124 | =item $buffers->avail_out |
123 | |
125 | |
124 | Returns the number of bytes still available in the output buffer. |
126 | Returns the number of bytes still available in the output buffer. |
125 | |
127 | |
… | |
… | |
129 | |
131 | |
130 | =back |
132 | =back |
131 | |
133 | |
132 | =head2 The File::Rdiff::Job class |
134 | =head2 The File::Rdiff::Job class |
133 | |
135 | |
|
|
136 | It is possible to have multiple jobs running at the same time. The idea |
|
|
137 | is to create job objects and then drive them incrementally with input or |
|
|
138 | output data until all date has been processed. |
|
|
139 | |
134 | =over 4 |
140 | =over 4 |
|
|
141 | |
|
|
142 | =item new_sig File::Rdiff::Job [$new_block_len[, $strong_sum_len]] |
|
|
143 | |
|
|
144 | Create a job that converts a base stream into a signature stream (i.e. creates signatures). |
|
|
145 | |
|
|
146 | =item new_loadsig File::Rdiff::Job |
|
|
147 | |
|
|
148 | Create a job that converts the input stream into a in-memory |
|
|
149 | File::Rdiff::Signature object. The signature object can be fetched anytime |
|
|
150 | with the C<signature>-method. |
|
|
151 | |
|
|
152 | =item new_delta File::Rdiff::Job $signature |
|
|
153 | |
|
|
154 | Creates a job that creates (outputs) a delta between the input stream (the |
|
|
155 | newer file) and the file represented by the given signature. |
|
|
156 | |
|
|
157 | =item new_patch File::Rdiff::Job $callback_or_filehandle |
|
|
158 | |
|
|
159 | Creates a job that patches a file according to the input stream (a delta |
|
|
160 | stream). The single argument is used to read the base file contents. If it |
|
|
161 | is a filehandle, it must be a seekable handle to the base file. |
|
|
162 | |
|
|
163 | If it is a coderef, it will be called whenever base file data must be |
|
|
164 | read. Two arguments will be passed: the file offset and the length. The |
|
|
165 | callback should eithe return the data read (must be a string, not a |
|
|
166 | number!) or an error code. |
|
|
167 | |
|
|
168 | =item $job->iter($buffers) |
|
|
169 | |
|
|
170 | Do as much work as possible given the input and/or output data in the |
|
|
171 | File::Rdiff::Buffers structure and return either C<DONE> when the job is |
|
|
172 | finished, C<BLOCKED> if there aren't enough bytes available in the input |
|
|
173 | or output buffers (in which case you should deplete the output buffer |
|
|
174 | and/or fill the input buffer and loop), or some error code indicating that |
|
|
175 | the operation failed. |
|
|
176 | |
|
|
177 | =item $job->signature |
|
|
178 | |
|
|
179 | Only valid for C<new_loadsig>, so look there. |
135 | |
180 | |
136 | =back |
181 | =back |
137 | |
182 | |
138 | =head1 SEE ALSO |
183 | =head1 SEE ALSO |
139 | |
184 | |