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