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