1# Extended stream operations on io.BytesIO
2try:
3    import uio as io
4except ImportError:
5    import io
6
7a = io.BytesIO(b"foobar")
8a.seek(10)
9print(a.read(10))
10
11a = io.BytesIO()
12print(a.seek(8))
13a.write(b"123")
14print(a.getvalue())
15
16print(a.seek(0, 1))
17
18print(a.seek(-1, 2))
19a.write(b"0")
20print(a.getvalue())
21
22a.flush()
23print(a.getvalue())
24
25a.seek(0)
26arr = bytearray(10)
27print(a.readinto(arr))
28print(arr)
29