~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to fpcdocs/bufstream.xml

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="ISO-8859-1"?>
 
2
<fpdoc-descriptions>
 
3
<package name="fcl">
 
4
 
 
5
<!--
 
6
  ====================================================================
 
7
    bufstream
 
8
  ====================================================================
 
9
-->
 
10
 
 
11
<module name="bufstream">
 
12
<short>Buffered stream</short>
 
13
<descr>
 
14
<p>
 
15
<file>BufStream</file> implements two one-way buffered streams: the streams
 
16
store all data from (or for) the source stream in a memory buffer, and only
 
17
flush the buffer when it's full (or refill it when it's empty).
 
18
The buffer size can be specified at creation time. 2 streams are
 
19
implemented: <link id="TReadBufStream"/> which is for reading only, and
 
20
<link id="TWriteBufStream"/> which is for writing only.
 
21
</p>
 
22
<p>
 
23
Buffered streams can help in speeding up read or write operations,
 
24
especially when a lot of small read/write operations are done: it 
 
25
avoids doing a lot of operating system calls.
 
26
</p>
 
27
</descr>
 
28
 
 
29
<!-- unresolved type reference Visibility: default -->
 
30
<element name="Classes">
 
31
<short>Stream definitions</short>
 
32
</element>
 
33
 
 
34
<!-- unresolved type reference Visibility: default -->
 
35
<element name="SysUtils">
 
36
<short>Exception support</short>
 
37
</element>
 
38
 
 
39
<!-- constant Visibility: default -->
 
40
<element name="DefaultBufferCapacity">
 
41
<short>Default buffer size</short>
 
42
<descr>
 
43
If no buffer size is specified when the stream is created, then this size is
 
44
used.
 
45
</descr>
 
46
<seealso>
 
47
<link id="TBufStream.Create"/>
 
48
</seealso>
 
49
</element>
 
50
 
 
51
<!--
 
52
  ********************************************************************
 
53
    #fcl.bufstream.TBufStream
 
54
  ********************************************************************
 
55
-->
 
56
 
 
57
<!-- object Visibility: default -->
 
58
<element name="TBufStream">
 
59
<short>Common ancestor for buffered streams</short>
 
60
<descr>
 
61
<var>TBufStream</var> is the common ancestor for the <link
 
62
id="TReadBufStream"/> and <link id="TWriteBufStream"/> streams. 
 
63
It completely handles the buffer memory management and position 
 
64
management. An instance of <var>TBufStream</var> should never 
 
65
be created directly. It also keeps the instance of the source stream.
 
66
</descr>
 
67
<seealso>
 
68
<link id="TReadBufStream"/>
 
69
<link id="TWriteBufStream"/>
 
70
</seealso>
 
71
</element>
 
72
 
 
73
<!-- constructor Visibility: public -->
 
74
<element name="TBufStream.Create">
 
75
<short>Create a new <var>TBufStream</var> instance.</short>
 
76
<descr>
 
77
<p>
 
78
<var>Create</var> creates a new <var>TBufStream</var> instance.
 
79
A buffer of size <var>ACapacity</var> is allocated, and the
 
80
<var>ASource</var> source (or destination) stream is stored.
 
81
If no capacity is specified, then <link id="DefaultBufferCapacity"/> is used
 
82
as the capacity.
 
83
</p>
 
84
<p>
 
85
An instance of <var>TBufStream</var> should never be instantiated 
 
86
directly. Instead, an instance of <link id="TReadBufStream"/> or
 
87
<link id="TWriteBufStream"/> should be created.
 
88
</p>
 
89
</descr>
 
90
<errors>
 
91
If not enough memory is available for the buffer, then an exception may be
 
92
raised.
 
93
</errors>
 
94
<seealso>
 
95
<link id="TBufStream.Destroy"/>
 
96
<link id="TReadBufStream"/>
 
97
<link id="TWriteBufStream"/>
 
98
</seealso>
 
99
</element>
 
100
 
 
101
<!-- destructor Visibility: public -->
 
102
<element name="TBufStream.Destroy">
 
103
<short>Destroys the <var>TBufStream</var> instance</short>
 
104
<descr>
 
105
<var>Destroy</var> destroys the instance of <var>TBufStream</var>. It
 
106
flushes the buffer, deallocates it, and then destroys the
 
107
<var>TBufStream</var> instance.
 
108
</descr>
 
109
<seealso>
 
110
<link id="TBufStream.Create"/>
 
111
<link id="TReadBufStream"/>
 
112
<link id="TWriteBufStream"/>
 
113
</seealso>
 
114
</element>
 
115
 
 
116
<!-- property Visibility: public -->
 
117
<element name="TBufStream.Buffer">
 
118
<short>The current buffer</short>
 
119
<descr>
 
120
<var>Buffer</var> is a pointer to the actual buffer in use.
 
121
</descr>
 
122
<seealso>
 
123
<link id="TBufStream.Create"/>
 
124
<link id="TBufStream.Capacity"/>
 
125
<link id="TBufStream.BufferSize"/>
 
126
</seealso>
 
127
</element>
 
128
 
 
129
<!-- property Visibility: public -->
 
130
<element name="TBufStream.Capacity">
 
131
<short>Current buffer capacity</short>
 
132
<descr>
 
133
<var>Capacity</var> is the amount of memory the buffer occupies.
 
134
To change the buffer size, the capacity can be set. Note that the
 
135
capacity cannot be set to a value that is less than the current
 
136
buffer size, i.e. the current amount of data in the buffer.
 
137
</descr>
 
138
<seealso>
 
139
<link id="TBufStream.Create"/>
 
140
<link id="TBufStream.Buffer"/>
 
141
<link id="TBufStream.BufferSize"/>
 
142
<link id="TBufStream.BufferPos"/>
 
143
</seealso>
 
144
</element>
 
145
 
 
146
<!-- property Visibility: public -->
 
147
<element name="TBufStream.BufferPos">
 
148
<short>Current buffer position.</short>
 
149
<descr>
 
150
<var>BufPos</var> is the current stream position in the buffer. Depending on
 
151
whether the stream is used for reading or writing, data will be read from
 
152
this position, or will be written at this position in the buffer.
 
153
</descr>
 
154
<seealso>
 
155
<link id="TBufStream.Create"/>
 
156
<link id="TBufStream.Buffer"/>
 
157
<link id="TBufStream.BufferSize"/>
 
158
<link id="TBufStream.Capacity"/>
 
159
</seealso>
 
160
</element>
 
161
 
 
162
<!-- property Visibility: public -->
 
163
<element name="TBufStream.BufferSize">
 
164
<short>Amount of data in the buffer</short>
 
165
<descr>
 
166
<var>BufferSize</var> is the actual amount of data in the buffer. This is
 
167
always less than or equal to the <link id="TBufStream.Capacity">Capacity</link>.
 
168
</descr>
 
169
<seealso>
 
170
<link id="TBufStream.Create"/>
 
171
<link id="TBufStream.Buffer"/>
 
172
<link id="TBufStream.BufferPos"/>
 
173
<link id="TBufStream.Capacity"/>
 
174
</seealso>
 
175
</element>
 
176
 
 
177
<!--
 
178
  ********************************************************************
 
179
    #fcl.bufstream.TReadBufStream
 
180
  ********************************************************************
 
181
-->
 
182
 
 
183
<!-- object Visibility: default -->
 
184
<element name="TReadBufStream">
 
185
<short>Read-only buffered stream.</short>
 
186
<descr>
 
187
<p>
 
188
<var>TReadBufStream</var> is a read-only buffered stream. It implements the
 
189
needed methods to read data from the buffer and fill the buffer with 
 
190
additional data when needed.
 
191
</p>
 
192
<p>
 
193
The stream provides limited forward-seek possibilities.
 
194
</p>
 
195
</descr>
 
196
<seealso>
 
197
<link id="TBufStream"/>
 
198
<link id="TWriteBufStream"/>
 
199
</seealso>
 
200
</element>
 
201
 
 
202
<!-- function Visibility: public -->
 
203
<element name="TReadBufStream.Seek">
 
204
<short>Set location in the buffer</short>
 
205
<descr>
 
206
<p>
 
207
<var>Seek</var> sets the location in the buffer. Currently, only a forward
 
208
seek is allowed. It is emulated by reading and discarding data. For an
 
209
explanation of the parameters, see <link id="#rtl.classes.tstream.seek">TStream.Seek"</link>
 
210
</p>
 
211
<p>
 
212
The seek method needs enhancement to enable it to do a full-featured seek.
 
213
This may be implemented in a future release of Free Pascal.
 
214
</p>
 
215
</descr>
 
216
<errors>
 
217
In case an illegal seek operation is attempted, an exception is raised.
 
218
</errors>
 
219
<seealso>
 
220
<link id="TWriteBufStream.Seek"/>
 
221
<link id="TReadBufStream.Read"/>
 
222
<link id="TReadBufStream.Write"/>
 
223
</seealso>
 
224
</element>
 
225
 
 
226
<!-- function Visibility: public -->
 
227
<element name="TReadBufStream.Read">
 
228
<short>Reads data from the stream</short>
 
229
<descr>
 
230
<p>
 
231
<var>Read</var> reads at most <var>ACount</var> bytes from the stream and
 
232
places them in <var>Buffer</var>. The number of actually read bytes is
 
233
returned.
 
234
</p>
 
235
<p>
 
236
<var>TReadBufStream</var> first reads whatever data is still available in
 
237
the buffer, and then refills the buffer, after which it continues to read
 
238
data from the buffer. This is repeated untill <var>ACount</var> bytes are
 
239
read, or no more data is available.
 
240
</p>
 
241
</descr>
 
242
<seealso>
 
243
<link id="TReadBufStream.Seek"/>
 
244
<link id="TReadBufStream.Read"/>
 
245
</seealso>
 
246
</element>
 
247
 
 
248
<!-- function Visibility: public -->
 
249
<element name="TReadBufStream.Write">
 
250
<short>Writes data to the stream</short>
 
251
<descr>
 
252
<var>Write</var> always raises an <var>EStreamError</var> exception, because
 
253
the stream is read-only. A <link id="TWriteBufStream"/> write stream must be
 
254
used to write data in a buffered way.
 
255
</descr>
 
256
<seealso>
 
257
<link id="TReadBufStream.Seek"/>
 
258
<link id="TReadBufStream.Read"/>
 
259
</seealso>
 
260
</element>
 
261
 
 
262
<!--
 
263
  ********************************************************************
 
264
    #fcl.bufstream.TWriteBufStream
 
265
  ********************************************************************
 
266
-->
 
267
 
 
268
<!-- object Visibility: default -->
 
269
<element name="TWriteBufStream">
 
270
<short>Write-only buffered stream.</short>
 
271
<descr>
 
272
<p>
 
273
<var>TWriteBufStream</var> is a write-only buffered stream. It implements the
 
274
needed methods to write data to the buffer and flush the buffer (i.e., write
 
275
its contents to the source stream) when needed.
 
276
</p>
 
277
</descr>
 
278
<seealso>
 
279
<link id="TBufStream"/>
 
280
<link id="TReadBufStream"/>
 
281
</seealso>
 
282
</element>
 
283
 
 
284
<!-- destructor Visibility: public -->
 
285
<element name="TWriteBufStream.Destroy">
 
286
<short>Remove the <var>TWriteBufStream</var> instance from memory</short>
 
287
<descr>
 
288
<var>Destroy</var> flushes the buffer and then calls the inherited
 
289
<link id="TBufstream.Destroy">Destroy</link>.
 
290
</descr>
 
291
<errors>
 
292
If an error occurs during flushing of the buffer, an exception may be
 
293
raised.
 
294
</errors>
 
295
<seealso>
 
296
<link id="TBufStream.Create">Create</link>
 
297
<link id="TBufStream.Destroy"/>
 
298
</seealso>
 
299
</element>
 
300
 
 
301
<!-- function Visibility: public -->
 
302
<element name="TWriteBufStream.Seek">
 
303
<short>Set stream position.</short>
 
304
<descr>
 
305
<p>
 
306
<var>Seek</var> always raises an <var>EStreamError</var> exception, 
 
307
except when the seek operation would not alter the current position.
 
308
</p>
 
309
<p>
 
310
A later implementation may perform a proper seek operation by flushing the
 
311
buffer and doing a seek on the source stream.
 
312
</p>
 
313
</descr>
 
314
<errors>
 
315
</errors>
 
316
<seealso>
 
317
<link id="TWriteBufStream.Write"/>
 
318
<link id="TWriteBufStream.Read"/>
 
319
<link id="TReadBufStream.Seek"/>
 
320
</seealso>
 
321
</element>
 
322
 
 
323
<!-- function Visibility: public -->
 
324
<element name="TWriteBufStream.Read">
 
325
<short>Read data from the stream</short>
 
326
<descr>
 
327
<var>Read</var> always raises an <var>EStreamError</var> 
 
328
exception since <var>TWriteBufStream</var> is write-only.
 
329
To read data in a buffered way, <link id="TReadBufStream"/> should be used.
 
330
</descr>
 
331
<seealso>
 
332
<link id="TWriteBufStream.Seek"/>
 
333
<link id="TWriteBufStream.Write"/>
 
334
<link id="TReadBufStream.Read"/>
 
335
</seealso>
 
336
</element>
 
337
 
 
338
<!-- function Visibility: public -->
 
339
<element name="TWriteBufStream.Write">
 
340
<short>Write data to the stream</short>
 
341
<descr>
 
342
<var>Write</var> writes at most <var>ACount</var> bytes from
 
343
<var>ABuffer</var> to the stream. The data is written to the 
 
344
internal buffer first. As soon as the internal buffer is full, it is flushed
 
345
to the destination stream, and the internal buffer is filled again. This
 
346
process continues till all data is written (or an error occurs).
 
347
</descr>
 
348
<errors>
 
349
An exception may occur if the destination stream has problems writing.
 
350
</errors>
 
351
<seealso>
 
352
<link id="TWriteBufStream.Seek"/>
 
353
<link id="TWriteBufStream.Read"/>
 
354
<link id="TReadBufStream.Write"/>
 
355
</seealso>
 
356
</element>
 
357
 
 
358
</module> <!-- bufstream -->
 
359
 
 
360
</package>
 
361
</fpdoc-descriptions>