Class Stream

java.lang.Object
org.libvirt.Stream
All Implemented Interfaces:
Closeable, AutoCloseable, ByteChannel, Channel, ReadableByteChannel, WritableByteChannel

public class Stream extends Object implements ByteChannel
The Stream class is used to transfer data between a libvirt daemon and a client.

It implements the ByteChannel interface.

Basic usage:


ByteBuffer buf = ByteBuffer.allocate(1024);
Stream str = conn.streamNew(0);

... // open the stream e.g. calling Domain.screenshot

while (str.read(buf) != -1) {
    buf.flip();
    ... // do something with the data
    buf.compact();
}

If you want to use this class as an InputStream or OutputStream, convert it using the Channels.newInputStream and Channels.newOutputStream respectively.