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

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

// StreamIO libvirt struct
type StreamIO struct {
	Stream libvirt.Stream
}

// NewStreamIO returns libvirt StreamIO
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)
}

// Close closes the stream
func (sio *StreamIO) Close() error {
	return sio.Stream.Finish()
}