+
+ def close(self, *args, **kwargs):
+ """
+ close the stream and release associated resources. A client should
+ not perform further operations on a StreamableContent::Stream
+ object after closing it.
+ """
+ func = self.get_dbus_method("close")
+ return func(*args, **kwargs)
+
+ def read(self, *args, **kwargs):
+ """
+ Request/read a specified amount of data from a Stream.
+ @return the number of bytes actually read into the client buffer.
+ """
+ func = self.get_dbus_method("read")
+ return func(*args, **kwargs)
+
+ def seek(self, *args, **kwargs):
+ """
+ Seek to a specified position in the Stream.
+ @param : offset
+ an offset specifying the requested position in the stream, relative
+ to the SeekType specified in whence.
+ @param : whence
+ a SeekType specifying the reference point from which the seek
+ offset is calculated. Some forms of seek are not supported by
+ certain implementations of Stream, in which case a NotSupported
+ exception will be raised.
+ @return the actual resulting offset, if no exception was raised.
+ """
+ func = self.get_dbus_method("seek")
+ return func(*args, **kwargs)
+
+ class IOError(Exception):
+ pass
+
+ class NoPermission(Exception):
+ pass
+
+ class NotSupported(Exception):
+ pass
+
+ class SeekType(Enum):
+ """
+ Specifies the meaning of a seek 'offset'. Not all SeekTypes are
+ supported by all StreamableContent data sources, for instance
+ some streams may not support seeking from the beginning or other
+ types of 'backwards' seeks.
+ """
+ _enum_lookup = {
+ 0:'SEEK_SET',
+ 1:'SEEK_CURRENT',
+ 2:'SEEK_END',
+ }
+
+ SEEK_CURRENT = SeekType(1)
+ SEEK_END = SeekType(2)
+ SEEK_SET = SeekType(0)