1Binary.setBlockData(3kaya) Kaya module reference Binary.setBlockData(3kaya)
2
3
4
6 Binary::setBlockData - Set the contents of a block.
7
9 Void setBlockData( Binary block, Int offset, [Int] bdata )
10
12 block The binary block
13
14 offset The offset to start at (zero-indexed)
15
16 bdata The data to write, as an array of Int s
17
19 Set the contents of (part of) a block from an array. An Binary.Off‐
20 setOutOfRange (3kaya) Exception will be thrown if this would cause a
21 write outside the bounds of the block. The following bits of code are
22 equivalent:
23
24
25 setBlockData(block,offset,bdata);
26 // is equivalent to
27 for byte@idx in bdata {
28 poke(block,offset+idx,byte);
29 }
30
31 However, setBlockData is more efficient and checks bounds before any
32 data is written - the above for loop could write partial data if off‐
33 set+idx was greater than blockSize(block)
34
35
37 Kaya standard library by Edwin Brady, Chris Morris and others
38 (kaya@kayalang.org). For further information see http://kayalang.org/
39
41 The Kaya standard library is free software; you can redistribute it
42 and/or modify it under the terms of the GNU Lesser General Public
43 License (version 2.1 or any later version) as published by the Free
44 Software Foundation.
45
47 Binary.Binary (3kaya)
48 Binary.array (3kaya)
49 Binary.copyBlock (3kaya)
50 Binary.getBlockChunk (3kaya)
51 Binary.poke (3kaya)
52 Binary.pokeString (3kaya)
53
54
55
56Kaya December 2010 Binary.setBlockData(3kaya)