]> mj.ucw.cz Git - libucw.git/blob - ucw/doc/fastbuf.txt
47109906c9d7bf739c97634334f695dc95bc316f
[libucw.git] / ucw / doc / fastbuf.txt
1 Fastbufs
2 ========
3
4 A *fastbuf* is a stream (or file) abstraction optimized for both speed
5 and flexibility.
6
7 Fastbufs can represent many different kinds of objects: regular files, network
8 sockets, file descriptors in general, or various memory buffers. These objects
9 are handled by different fastbuf *back-ends.*
10
11 Once you have a fastbuf, you can access it by fuctions similar to those of
12 `stdio.h`, or you can use a variety of fastbuf *front-ends* providing various
13 formatted operations.
14
15 Please keep in mind that fastbufs do not allow arbitrary mixing of reads and
16 writes on the same stream. If you need to mix them, you have to call @bflush()
17 inbetween and remember that the file position reported by @btell() points after
18 the flushed buffer, which is not necessarily the same as after the data you've
19 really read.
20
21 Fastbufs can also participate in the libucw resource management system.
22 You can tie a fastbuf to a resource in the current resource pool by @fb_tie().
23 When the pool gets cleaned up, the fastbuf is automatically closed. If you call
24 @bclose() explicitly, the resource is removed, too.
25
26 .Back-ends:
27 - <<fbparam,Files (parametrized)>>
28 - <<fbfile,Regular files>>
29 - <<fbtemp,Temporary files>>
30 - <<fblim,File fragments>>
31 - <<fbmem,In-memory streams>>
32 - <<fbbuf,Buffers>>
33 - <<fbgrow,Growing buffers>>
34 - <<fbpool,Memory pools>>
35 - <<fbatomic,Atomic files>>
36
37 .Front-ends:
38 - <<ffbasic,Basic functions>>
39
40 .Other reading:
41 - <<internal,Internal structure>>
42 - <<bconfig,Configuring streams>>
43
44 ucw/fastbuf.h
45 -------------
46
47 !!ucw/fastbuf.h
48
49 ucw/fb-socket.h
50 ---------------
51
52 Fastbufs on network sockets with timeouts.
53
54 !!ucw/fb-socket.h
55
56 ucw/ff-unicode.h
57 ----------------
58
59 Reading and writing of unicode characters.
60
61 Invalid codes are replaced by `UNI_REPLACEMENT` when reading.
62
63 !!ucw/ff-unicode.h
64
65 ucw/ff-binary.h
66 ---------------
67
68 !!ucw/ff-binary.h