2016-08-24 12:03:22 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2024-05-23 09:26:56 +02:00
|
|
|
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2016-08-24 12:03:22 +02:00
|
|
|
*/
|
|
|
|
namespace OCP\Files\SimpleFS;
|
|
|
|
|
2018-02-09 20:15:29 +01:00
|
|
|
use OCP\Files\NotFoundException;
|
2016-08-24 12:03:22 +02:00
|
|
|
use OCP\Files\NotPermittedException;
|
|
|
|
|
|
|
|
/**
|
2022-03-07 17:20:52 +00:00
|
|
|
* This interface allows to manage simple files.
|
|
|
|
*
|
|
|
|
* This interface must not be implemented in your application but
|
|
|
|
* instead should be used as a service and injected in your code with
|
|
|
|
* dependency injection.
|
2016-08-24 12:03:22 +02:00
|
|
|
*
|
2016-11-15 18:51:52 +01:00
|
|
|
* @since 11.0.0
|
2016-08-24 12:03:22 +02:00
|
|
|
*/
|
|
|
|
interface ISimpleFile {
|
|
|
|
/**
|
|
|
|
* Get the name
|
|
|
|
*
|
2016-11-15 18:51:52 +01:00
|
|
|
* @since 11.0.0
|
2016-08-24 12:03:22 +02:00
|
|
|
*/
|
2022-06-22 12:05:26 +02:00
|
|
|
public function getName(): string;
|
2016-08-24 12:03:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the size in bytes
|
|
|
|
*
|
2016-11-15 18:51:52 +01:00
|
|
|
* @since 11.0.0
|
2016-08-24 12:03:22 +02:00
|
|
|
*/
|
2023-01-23 15:03:56 +01:00
|
|
|
public function getSize(): int|float;
|
2016-08-24 12:03:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the ETag
|
|
|
|
*
|
2016-11-15 18:51:52 +01:00
|
|
|
* @since 11.0.0
|
2016-08-24 12:03:22 +02:00
|
|
|
*/
|
2022-06-22 12:05:26 +02:00
|
|
|
public function getETag(): string;
|
2016-08-24 12:03:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the last modification time
|
|
|
|
*
|
2016-11-15 18:51:52 +01:00
|
|
|
* @since 11.0.0
|
2016-08-24 12:03:22 +02:00
|
|
|
*/
|
2022-06-22 12:05:26 +02:00
|
|
|
public function getMTime(): int;
|
2016-08-24 12:03:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the content
|
|
|
|
*
|
2018-02-09 20:15:29 +01:00
|
|
|
* @throws NotPermittedException
|
|
|
|
* @throws NotFoundException
|
2016-11-15 18:51:52 +01:00
|
|
|
* @since 11.0.0
|
2016-08-24 12:03:22 +02:00
|
|
|
*/
|
2022-06-22 12:05:26 +02:00
|
|
|
public function getContent(): string;
|
2016-08-24 12:03:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Overwrite the file
|
|
|
|
*
|
2018-06-26 11:07:41 +02:00
|
|
|
* @param string|resource $data
|
2016-08-24 12:03:22 +02:00
|
|
|
* @throws NotPermittedException
|
2019-04-08 13:21:46 +02:00
|
|
|
* @throws NotFoundException
|
2016-11-15 18:51:52 +01:00
|
|
|
* @since 11.0.0
|
2016-08-24 12:03:22 +02:00
|
|
|
*/
|
2022-06-22 12:05:26 +02:00
|
|
|
public function putContent($data): void;
|
2016-08-24 12:03:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete the file
|
|
|
|
*
|
|
|
|
* @throws NotPermittedException
|
2016-11-15 18:51:52 +01:00
|
|
|
* @since 11.0.0
|
2016-08-24 12:03:22 +02:00
|
|
|
*/
|
2022-06-22 12:05:26 +02:00
|
|
|
public function delete(): void;
|
2016-08-24 12:03:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the MimeType
|
|
|
|
*
|
2016-11-15 18:51:52 +01:00
|
|
|
* @since 11.0.0
|
2016-08-24 12:03:22 +02:00
|
|
|
*/
|
2022-06-22 12:05:26 +02:00
|
|
|
public function getMimeType(): string;
|
2018-07-05 18:08:56 +02:00
|
|
|
|
2022-03-03 05:10:57 +00:00
|
|
|
/**
|
|
|
|
* @since 24.0.0
|
|
|
|
*/
|
|
|
|
public function getExtension(): string;
|
|
|
|
|
2018-07-05 18:08:56 +02:00
|
|
|
/**
|
2018-07-10 14:27:47 +02:00
|
|
|
* Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen
|
2018-07-05 18:08:56 +02:00
|
|
|
*
|
2023-03-13 18:59:16 +01:00
|
|
|
* @return resource|false
|
2018-07-05 18:08:56 +02:00
|
|
|
* @throws \OCP\Files\NotPermittedException
|
|
|
|
* @since 14.0.0
|
|
|
|
*/
|
2018-07-10 14:27:47 +02:00
|
|
|
public function read();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
|
|
|
|
*
|
2020-12-03 11:03:17 +01:00
|
|
|
* @return resource|bool
|
2018-07-10 14:27:47 +02:00
|
|
|
* @throws \OCP\Files\NotPermittedException
|
|
|
|
* @since 14.0.0
|
|
|
|
*/
|
|
|
|
public function write();
|
2016-08-24 12:03:22 +02:00
|
|
|
}
|