ooodev.adapter.ucb.simple_file_access_partial module

class ooodev.adapter.ucb.simple_file_access_partial.SimpleFileAccessPartial(component, interface=com.sun.star.ucb.XSimpleFileAccess)[source]

Bases: object

Partial Class XSimpleFileAccess.

Parameters:
  • component (XSimpleFileAccess) –

  • interface (UnoInterface | None) –

__init__(component, interface=com.sun.star.ucb.XSimpleFileAccess)[source]

Constructor

Parameters:
  • component (XSimpleFileAccess) – UNO Component that implements com.sun.star.ucb.XSimpleFileAccess interface.

  • interface (UnoInterface, optional) – The interface to be validated. Defaults to XSimpleFileAccess.

Return type:

None

copy(source_url, dest_url)[source]

Copies a file.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

None

Parameters:
  • source_url (str) –

  • dest_url (str) –

create_folder(new_folder_url)[source]

Creates a new Folder.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

None

Parameters:

new_folder_url (str) –

exists(file_url)[source]

Checks if a file exists.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

bool

Parameters:

file_url (str) –

get_content_type(file_url)[source]

Returns the content type of a file.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

str

Parameters:

file_url (str) –

get_date_time_modified(file_url)[source]

Returns the last modified date for the file.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

datetime

Parameters:

file_url (str) –

get_folder_contents(folder_url, include_folders=True)[source]

Returns the contents of a folder.

Parameters:
  • folder_url (str) – The URL of the folder.

  • include_folders (bool, optional) – If True, folders are included in the result. Defaults to True.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

Tuple[str, ...]

get_size(file_url)[source]

Returns the size of a file.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

int

Parameters:

file_url (str) –

is_folder(file_url)[source]

Checks if a URL represents a folder.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

bool

Parameters:

file_url (str) –

is_read_only(file_url)[source]

Checks if a file is read only.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

bool

Parameters:

file_url (str) –

kill(file_url)[source]

Removes a file.

If the URL represents a folder, the folder will be removed, even if it’s not empty.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

None

Parameters:

file_url (str) –

move(source_url, dest_url)[source]

Moves a file.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

None

Parameters:
  • source_url (str) –

  • dest_url (str) –

open_file_read(file_url)[source]

Opens file to read.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

XInputStream

Parameters:

file_url (str) –

open_file_read_write(file_url)[source]

Opens file to read and write.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

XStream

Parameters:

file_url (str) –

open_file_write(file_url)[source]

Opens file to write.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

XOutputStream

Parameters:

file_url (str) –

set_interaction_handler(handler)[source]

Sets an interaction handler to be used for further operations.

A default interaction handler is available as service com.sun.star.task.InteractionHandler. The documentation of this service also contains further information about the interaction handler concept.

Return type:

None

Parameters:

handler (com.sun.star.task.XInteractionHandler) –

set_read_only(file_url, read_only)[source]

Sets the read only of a file according to the boolean parameter, if the actual process has the right to do so.

Raises:
  • com.sun.star.ucb.CommandAbortedExceptionCommandAbortedException

  • com.sun.star.uno.ExceptionException

Return type:

None

Parameters:
  • file_url (str) –

  • read_only (bool) –