June 2014
Intermediate to advanced
696 pages
38h 52m
English
You cannot extend the size of a Buffer object after it has been created, but you can write data to any location in the buffer. As described in Table 5.2, there are several methods you can use when writing to buffers.
Table 5.2 Methods for writing to Buffer objects
To illustrate writing to buffers, the code in Listing 5.1 defines a buffer, fills it with zeros, writes some text at the beginning using write() at line 4, and adds some additional text that alters part of the existing buffer via write(string, offset, length) at line 6. Then in line 8 it adds a + to the end by directly setting the value of an index. Figure 5.1 shows ...
Read now
Unlock full access