maxon.IoConnectionInterface

Description

The connection interface a given maxon.Url.
This connection needs to be implemented for each protocol.

Inheritance diagram

Inheritance

Parent Class:

Child Class:

Methods Signature

GetBrowseIterator(flags)

Returns a maxon.IoBrowseInterface class to browse through all children of an Url.

GetContentLength()

Returns length of the content.

GetUrl()

Returns the corresponding maxon.Url connected to the maxon.IoConnectionRef.

IoCopyFile(destName, overwrite, removeReadOnly)

Copies a file to a different location, the path must exist otherwise the function returns an error.

IoCreateDirectory(createParents[, createDirs])

Creates a new directory.

IoDelete(force)

Deletes the file physically on the medium.

IoDetect()

Detects the type of the maxon.Url.

IoGetAttributes()

Returns the file attributes.

IoGetFreeVolumeSpace()

Calculates the free space on a volume.

IoGetTime(mode)

Returns the maxon.DateTime of the current file.

IoMove(destName)

Moves a file or directory (including hierarchy) to a different location.

IoRename(newName)

Renames a file or directory.

IoSetAttributes(flags, mask)

Modify the file attributes.

IoSetTime(mode, dateTime)

Modifies the maxon.DateTime of the current file.

IoShowInOS(flags)

Opens or shows the file in the systems explorer (desktop/finder).

OpenInOutputStream(self[, flags])

Opens an maxon.InOutputStreamRef for the given connection.

OpenInputStream(self[, flags])

Opens an maxon.InputStreamRef for the given connection.

OpenOutputStream(self[, flags])

Opens an maxon.OutputStreamRef for the given connection.

Methods Definition

IoConnectionInterface.GetBrowseIterator(flags)
Returns a maxon.IoBrowseInterface class to browse through all children of an Url.
The return value needs to be checked against None.
Parameters

flags (maxon.GETBROWSEITERATORFLAGS) – Defines how the iterator resolve data.

Returns

The iterator.

Return type

maxon.IoBrowseInterface

IoConnectionInterface.GetContentLength()

Returns length of the content.

Returns

The effective size in bytes of the maxon.IoConnectionInterface (e.g. filesize).

Return type

int

IoConnectionInterface.GetUrl()

Returns the corresponding maxon.Url connected to the maxon.IoConnectionRef. :return: Returns the name of the connection. :rtype: maxon.Url

IoConnectionInterface.IoCopyFile(destName, overwrite, removeReadOnly)

Copies a file to a different location, the path must exist otherwise the function returns an error.

Parameters
  • destName (maxon.Url) – Destination name for the copy operation.

  • overwrite (bool) – True to allow overwriting destName file if it was already there.

  • removeReadOnly (bool) – True to remove the read only flag on the newly created copy.

IoConnectionInterface.IoCreateDirectory(createParents, createDirs=None)

Creates a new directory.

Note

The function returns false if the directory already exists.

Parameters
  • createParents (bool) – Check if parent directory exists and if not create them recursively.

  • createDirs (maxon.BaseArray [maxon.Url]) –

    An array that will contain all newly created subdirectories in the order in which they were created.
    If this parameter is None it will be ignored.

IoConnectionInterface.IoDelete(force)

Deletes the file physically on the medium.

Parameters

force – True tries to deletes the file/directory even if the file/directory has read only flags set.

Returns

True if the file/directory could be removed successfully.

Return type

bool

IoConnectionInterface.IoDetect()
Detects the type of the maxon.Url.
This allows to check if a file or directory exists.
Returns

Flags defining the detection state.

Return type

maxon.IODETECT

IoConnectionInterface.IoGetAttributes()

Returns the file attributes.

Returns

IOATTRIBUTES of the files.

Return type

maxon.IOATTRIBUTES

IoConnectionInterface.IoGetFreeVolumeSpace()

Calculates the free space on a volume.

Note

The maxon.Url can point to a volume or directory.

Returns

In the next order:

  1. The number of available bytes on the volume.

  2. The total size of the volume in bytes.

Return type

tuple(int, int)

IoConnectionInterface.IoGetTime(mode)
Returns the maxon.DateTime of the current file.
The time is in local time.
Parameters

mode (maxon.IOTIMEMODE) – IOTIMEMODE of the requested time.

Returns

Returns the maxon.DateTime or an error.

Return type

maxon.UniversalDateTime

IoConnectionInterface.IoMove(destName)
Moves a file or directory (including hierarchy) to a different location.
The path must exist otherwise the function returns an error.

If the destName file or directory does already exist the function returns with an error.

Moving a file or directory on the same partition will perform without a temporary copy.
Parameters

destName (maxon.Url) – Destination name for the move operation.

IoConnectionInterface.IoRename(newName)

Renames a file or directory.

Warning

The newName must not be the name of an existing file or directory.

Parameters
  • newName – New name for the rename operation.

  • newNamemaxon.Url

Returns

IoConnectionInterface.IoSetAttributes(flags, mask)

Modify the file attributes.

Parameters
  • flags – Flags to set/clear.

  • flagsmaxon.IOATTRIBUTES

  • mask – Mask with all flags to be changed.

  • maskmaxon.IOATTRIBUTES

IoConnectionInterface.IoSetTime(mode, dateTime)

Modifies the maxon.DateTime of the current file. the time is in local time.

Parameters
  • mode (maxon.IOTIMEMODE) – IOTIMEMODE of the requested time.

  • dateTime (maxon.UniversalDateTime) – New datetime for the file.

IoConnectionInterface.IoShowInOS(flags)
Opens or shows the file in the systems explorer (desktop/finder).

Under windows that would be on the desktop/explorer.
Under OSX this would be the Finder.

Depending on the url scheme this could also open another browser.
Parameters

flags (maxon.IOSHOWINOSFLAGS) – Flags to define how to show/open that file.

IoConnectionInterface.OpenInOutputStream(self, flags=enums.OPENSTREAMFLAGS.NONE)
Opens an maxon.InOutputStreamRef for the given connection.
With this kind of streams it’s possible to read/write to it.
Parameters

flags (maxon.OPENSTREAMFLAGS) – Defines how the stream will be handled.

Returns

An input stream, should be free with ObjectInterface.Free().

Return type

maxon.InOutputStreamRef

IoConnectionInterface.OpenInputStream(self, flags=enums.OPENSTREAMFLAGS.NONE)
Opens an maxon.InputStreamRef for the given connection.
With this kind of streams it’s only possible to read from it.
Parameters

flags (maxon.OPENSTREAMFLAGS) – Defines how the stream will be handled.

Returns

An input stream, should be free with ObjectInterface.Free().

Return type

maxon.InputStreamRef

IoConnectionInterface.OpenOutputStream(self, flags=enums.OPENSTREAMFLAGS.NONE)
Opens an maxon.OutputStreamRef for the given connection.
With this kind of streams it’s only possible to write to it.
Parameters

flags (maxon.OPENSTREAMFLAGS) – Defines how the stream will be handled.

Returns

An input stream, should be free with ObjectInterface.Free().

Return type

maxon.OutputStreamRef