aboutsummaryrefslogtreecommitdiff
path: root/libvirt/stream.go
blob: fcfed2cff4e01c63d477cbcc98830aabe88f7a21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package libvirt

import libvirt "github.com/libvirt/libvirt-go"

type StreamIO struct {
	Stream libvirt.Stream
}

func NewStreamIO(s libvirt.Stream) *StreamIO {
	return &StreamIO{Stream: s}
}

func (sio *StreamIO) Read(p []byte) (int, error) {
	return sio.Stream.Recv(p)
}

func (sio *StreamIO) Write(p []byte) (int, error) {
	return sio.Stream.Send(p)
}

func (sio *StreamIO) Close() error {
	return sio.Stream.Finish()
}