|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.DebugClients.Ruby.AsyncFile</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.DebugClients.Ruby.AsyncFile</h1> |
|
23 <p> |
|
24 File implementing an asynchronous file like socket interface for the debugger. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#AsyncFile">AsyncFile</a></td> |
|
34 <td>Class wrapping a socket object with a file interface.</td> |
|
35 </tr> |
|
36 </table> |
|
37 <h3>Modules</h3> |
|
38 <table> |
|
39 <tr><td>None</td></tr> |
|
40 </table> |
|
41 <h3>Functions</h3> |
|
42 <table> |
|
43 <tr> |
|
44 <td><a href="#<<"><<</a></td> |
|
45 <td>Synonym for write(s).</td> |
|
46 </tr><tr> |
|
47 <td><a href="#AsyncPendingWrite">AsyncPendingWrite</a></td> |
|
48 <td>Module function to check for data to be written.</td> |
|
49 </tr><tr> |
|
50 <td><a href="#close">close</a></td> |
|
51 <td>Public method to close the file.</td> |
|
52 </tr><tr> |
|
53 <td><a href="#fileno">fileno</a></td> |
|
54 <td>Public method returning the file number.</td> |
|
55 </tr><tr> |
|
56 <td><a href="#flush">flush</a></td> |
|
57 <td>Public method to write all pending bytes.</td> |
|
58 </tr><tr> |
|
59 <td><a href="#getSock">getSock</a></td> |
|
60 <td>Public method to get the socket object.</td> |
|
61 </tr><tr> |
|
62 <td><a href="#gets">gets</a></td> |
|
63 <td>Public method to read a line from this file.</td> |
|
64 </tr><tr> |
|
65 <td><a href="#isatty">isatty</a></td> |
|
66 <td>Public method to indicate whether a tty interface is supported.</td> |
|
67 </tr><tr> |
|
68 <td><a href="#pendingWrite">pendingWrite</a></td> |
|
69 <td>Public method that returns the number of bytes waiting to be written.</td> |
|
70 </tr><tr> |
|
71 <td><a href="#read">read</a></td> |
|
72 <td>Public method to read bytes from this file.</td> |
|
73 </tr><tr> |
|
74 <td><a href="#readline">readline</a></td> |
|
75 <td>Public method to read a line from this file.</td> |
|
76 </tr><tr> |
|
77 <td><a href="#readlines">readlines</a></td> |
|
78 <td>Public method to read all lines from this file.</td> |
|
79 </tr><tr> |
|
80 <td><a href="#seek">seek</a></td> |
|
81 <td>Public method to move the filepointer.</td> |
|
82 </tr><tr> |
|
83 <td><a href="#tell">tell</a></td> |
|
84 <td>Public method to get the filepointer position.</td> |
|
85 </tr><tr> |
|
86 <td><a href="#write">write</a></td> |
|
87 <td>Public method to write a string to the file.</td> |
|
88 </tr><tr> |
|
89 <td><a href="#writelines">writelines</a></td> |
|
90 <td>Public method to write a list of strings to the file.</td> |
|
91 </tr> |
|
92 </table> |
|
93 <hr /><hr /> |
|
94 <a NAME="AsyncFile" ID="AsyncFile"></a> |
|
95 <h2>AsyncFile</h2> |
|
96 <p> |
|
97 Class wrapping a socket object with a file interface. |
|
98 </p> |
|
99 <h3>Derived from</h3> |
|
100 None |
|
101 <h3>Class Attributes</h3> |
|
102 <table> |
|
103 <tr><td>@@maxbuffersize</td></tr><tr><td>@@maxtries</td></tr> |
|
104 </table> |
|
105 <h3>Class Methods</h3> |
|
106 <table> |
|
107 <tr><td>None</td></tr> |
|
108 </table> |
|
109 <h3>Methods</h3> |
|
110 <table> |
|
111 <tr> |
|
112 <td><a href="#AsyncFile.checkMode">checkMode</a></td> |
|
113 <td>Private method to check the mode.</td> |
|
114 </tr><tr> |
|
115 <td><a href="#AsyncFile.initialize">initialize</a></td> |
|
116 <td>Constructor</td> |
|
117 </tr><tr> |
|
118 <td><a href="#AsyncFile.nWrite">nWrite</a></td> |
|
119 <td>Private method to write a specific number of pending bytes.</td> |
|
120 </tr> |
|
121 </table> |
|
122 <h3>Static Methods</h3> |
|
123 <table> |
|
124 <tr><td>None</td></tr> |
|
125 </table> |
|
126 <a NAME="AsyncFile.checkMode" ID="AsyncFile.checkMode"></a> |
|
127 <h4>AsyncFile.checkMode</h4> |
|
128 <b>checkMode</b>(<i></i>) |
|
129 <p> |
|
130 Private method to check the mode. |
|
131 </p><p> |
|
132 This method checks, if an operation is permitted according to |
|
133 the mode of the file. If it is not, an IOError is raised. |
|
134 </p><dl> |
|
135 <dt><i>mode</i></dt> |
|
136 <dd> |
|
137 the mode to be checked (string) |
|
138 </dd> |
|
139 </dl><a NAME="AsyncFile.initialize" ID="AsyncFile.initialize"></a> |
|
140 <h4>AsyncFile.initialize</h4> |
|
141 <b>initialize</b>(<i>mode, name</i>) |
|
142 <p> |
|
143 Constructor |
|
144 </p><dl> |
|
145 <dt><i>sock</i></dt> |
|
146 <dd> |
|
147 the socket object being wrapped |
|
148 </dd><dt><i>mode</i></dt> |
|
149 <dd> |
|
150 mode of this file (string) |
|
151 </dd><dt><i>name</i></dt> |
|
152 <dd> |
|
153 name of this file (string) |
|
154 </dd> |
|
155 </dl><a NAME="AsyncFile.nWrite" ID="AsyncFile.nWrite"></a> |
|
156 <h4>AsyncFile.nWrite</h4> |
|
157 <b>nWrite</b>(<i></i>) |
|
158 <p> |
|
159 Private method to write a specific number of pending bytes. |
|
160 </p><dl> |
|
161 <dt><i>n</i></dt> |
|
162 <dd> |
|
163 the number of bytes to be written (int) |
|
164 </dd> |
|
165 </dl> |
|
166 <div align="right"><a href="#top">Up</a></div> |
|
167 <hr /><hr /> |
|
168 <a NAME="<<" ID="<<"></a> |
|
169 <h2><<</h2> |
|
170 <b><<</b>(<i>s</i>) |
|
171 <p> |
|
172 Synonym for write(s). |
|
173 </p><dl> |
|
174 <dt><i>s</i></dt> |
|
175 <dd> |
|
176 bytes to be written (string) |
|
177 </dd> |
|
178 </dl> |
|
179 <div align="right"><a href="#top">Up</a></div> |
|
180 <hr /><hr /> |
|
181 <a NAME="AsyncPendingWrite" ID="AsyncPendingWrite"></a> |
|
182 <h2>AsyncPendingWrite</h2> |
|
183 <b>AsyncPendingWrite</b>(<i>file</i>) |
|
184 <p> |
|
185 Module function to check for data to be written. |
|
186 </p><dl> |
|
187 <dt><i>file</i></dt> |
|
188 <dd> |
|
189 The file object to be checked (file) |
|
190 </dd> |
|
191 </dl><dl> |
|
192 <dt>Returns:</dt> |
|
193 <dd> |
|
194 Flag indicating if there is data wating (int) |
|
195 </dd> |
|
196 </dl> |
|
197 <div align="right"><a href="#top">Up</a></div> |
|
198 <hr /><hr /> |
|
199 <a NAME="close" ID="close"></a> |
|
200 <h2>close</h2> |
|
201 <b>close</b>(<i></i>) |
|
202 <p> |
|
203 Public method to close the file. |
|
204 </p> |
|
205 <div align="right"><a href="#top">Up</a></div> |
|
206 <hr /><hr /> |
|
207 <a NAME="fileno" ID="fileno"></a> |
|
208 <h2>fileno</h2> |
|
209 <b>fileno</b>(<i></i>) |
|
210 <p> |
|
211 Public method returning the file number. |
|
212 </p><dl> |
|
213 <dt>Returns:</dt> |
|
214 <dd> |
|
215 file number (int) |
|
216 </dd> |
|
217 </dl> |
|
218 <div align="right"><a href="#top">Up</a></div> |
|
219 <hr /><hr /> |
|
220 <a NAME="flush" ID="flush"></a> |
|
221 <h2>flush</h2> |
|
222 <b>flush</b>(<i></i>) |
|
223 <p> |
|
224 Public method to write all pending bytes. |
|
225 </p> |
|
226 <div align="right"><a href="#top">Up</a></div> |
|
227 <hr /><hr /> |
|
228 <a NAME="getSock" ID="getSock"></a> |
|
229 <h2>getSock</h2> |
|
230 <b>getSock</b>(<i></i>) |
|
231 <p> |
|
232 Public method to get the socket object. |
|
233 </p><dl> |
|
234 <dt>Returns:</dt> |
|
235 <dd> |
|
236 the socket object |
|
237 </dd> |
|
238 </dl> |
|
239 <div align="right"><a href="#top">Up</a></div> |
|
240 <hr /><hr /> |
|
241 <a NAME="gets" ID="gets"></a> |
|
242 <h2>gets</h2> |
|
243 <b>gets</b>(<i></i>) |
|
244 <p> |
|
245 Public method to read a line from this file. |
|
246 </p> |
|
247 <div align="right"><a href="#top">Up</a></div> |
|
248 <hr /><hr /> |
|
249 <a NAME="isatty" ID="isatty"></a> |
|
250 <h2>isatty</h2> |
|
251 <b>isatty</b>(<i></i>) |
|
252 <p> |
|
253 Public method to indicate whether a tty interface is supported. |
|
254 </p><dl> |
|
255 <dt>Returns:</dt> |
|
256 <dd> |
|
257 always false |
|
258 </dd> |
|
259 </dl> |
|
260 <div align="right"><a href="#top">Up</a></div> |
|
261 <hr /><hr /> |
|
262 <a NAME="pendingWrite" ID="pendingWrite"></a> |
|
263 <h2>pendingWrite</h2> |
|
264 <b>pendingWrite</b>(<i></i>) |
|
265 <p> |
|
266 Public method that returns the number of bytes waiting to be written. |
|
267 </p><dl> |
|
268 <dt>Returns:</dt> |
|
269 <dd> |
|
270 the number of bytes to be written (int) |
|
271 </dd> |
|
272 </dl> |
|
273 <div align="right"><a href="#top">Up</a></div> |
|
274 <hr /><hr /> |
|
275 <a NAME="read" ID="read"></a> |
|
276 <h2>read</h2> |
|
277 <b>read</b>(<i>size = -1</i>) |
|
278 <p> |
|
279 Public method to read bytes from this file. |
|
280 </p><dl> |
|
281 <dt><i>size</i></dt> |
|
282 <dd> |
|
283 maximum number of bytes to be read (int) |
|
284 </dd> |
|
285 </dl><dl> |
|
286 <dt>Returns:</dt> |
|
287 <dd> |
|
288 the bytes read (any) |
|
289 </dd> |
|
290 </dl> |
|
291 <div align="right"><a href="#top">Up</a></div> |
|
292 <hr /><hr /> |
|
293 <a NAME="readline" ID="readline"></a> |
|
294 <h2>readline</h2> |
|
295 <b>readline</b>(<i>size = -1</i>) |
|
296 <p> |
|
297 Public method to read a line from this file. |
|
298 </p><p> |
|
299 <b>Note</b>: This method will not block and may return |
|
300 only a part of a line if that is all that is available. |
|
301 </p><dl> |
|
302 <dt><i>size</i></dt> |
|
303 <dd> |
|
304 maximum number of bytes to be read (int) |
|
305 </dd> |
|
306 </dl><dl> |
|
307 <dt>Returns:</dt> |
|
308 <dd> |
|
309 one line of text up to size bytes (string) |
|
310 </dd> |
|
311 </dl> |
|
312 <div align="right"><a href="#top">Up</a></div> |
|
313 <hr /><hr /> |
|
314 <a NAME="readlines" ID="readlines"></a> |
|
315 <h2>readlines</h2> |
|
316 <b>readlines</b>(<i>sizehint = -1</i>) |
|
317 <p> |
|
318 Public method to read all lines from this file. |
|
319 </p><dl> |
|
320 <dt><i>sizehint</i></dt> |
|
321 <dd> |
|
322 hint of the numbers of bytes to be read (int) |
|
323 </dd> |
|
324 </dl><dl> |
|
325 <dt>Returns:</dt> |
|
326 <dd> |
|
327 list of lines read (list of strings) |
|
328 </dd> |
|
329 </dl> |
|
330 <div align="right"><a href="#top">Up</a></div> |
|
331 <hr /><hr /> |
|
332 <a NAME="seek" ID="seek"></a> |
|
333 <h2>seek</h2> |
|
334 <b>seek</b>(<i>offset, whence=IO::SEEK_SET</i>) |
|
335 <p> |
|
336 Public method to move the filepointer. |
|
337 </p><dl> |
|
338 <dt>Raises <b>IOError</b>:</dt> |
|
339 <dd> |
|
340 This method is not supported and always raises an |
|
341 IOError. |
|
342 </dd> |
|
343 </dl> |
|
344 <div align="right"><a href="#top">Up</a></div> |
|
345 <hr /><hr /> |
|
346 <a NAME="tell" ID="tell"></a> |
|
347 <h2>tell</h2> |
|
348 <b>tell</b>(<i></i>) |
|
349 <p> |
|
350 Public method to get the filepointer position. |
|
351 </p><dl> |
|
352 <dt>Raises <b>IOError</b>:</dt> |
|
353 <dd> |
|
354 This method is not supported and always raises an |
|
355 IOError. |
|
356 </dd> |
|
357 </dl> |
|
358 <div align="right"><a href="#top">Up</a></div> |
|
359 <hr /><hr /> |
|
360 <a NAME="write" ID="write"></a> |
|
361 <h2>write</h2> |
|
362 <b>write</b>(<i>s</i>) |
|
363 <p> |
|
364 Public method to write a string to the file. |
|
365 </p><dl> |
|
366 <dt><i>s</i></dt> |
|
367 <dd> |
|
368 bytes to be written (string) |
|
369 </dd> |
|
370 </dl> |
|
371 <div align="right"><a href="#top">Up</a></div> |
|
372 <hr /><hr /> |
|
373 <a NAME="writelines" ID="writelines"></a> |
|
374 <h2>writelines</h2> |
|
375 <b>writelines</b>(<i>list</i>) |
|
376 <p> |
|
377 Public method to write a list of strings to the file. |
|
378 </p><dl> |
|
379 <dt><i>list</i></dt> |
|
380 <dd> |
|
381 the list to be written (list of string) |
|
382 </dd> |
|
383 </dl> |
|
384 <div align="right"><a href="#top">Up</a></div> |
|
385 <hr /> |
|
386 </body></html> |