2013-09-06 22:38:59 +04:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 18:07:57 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
|
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
2016-07-21 19:13:36 +03:00
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
2016-07-21 18:07:57 +03:00
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2013-11-03 16:51:39 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* @license AGPL-3.0
|
2013-11-03 16:51:39 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
2013-11-03 16:51:39 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2013-11-03 16:51:39 +04:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-03-26 13:44:34 +03:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
2013-11-03 16:51:39 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2013-11-03 16:51:39 +04:00
|
|
|
*
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
2015-02-26 13:37:37 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Public interface of ownCloud for apps to use.
|
|
|
|
* Files/File interface
|
|
|
|
*/
|
|
|
|
|
2013-11-03 16:51:39 +04:00
|
|
|
// use OCP namespace for all classes that are considered public.
|
|
|
|
// This means that they should be used by apps instead of the internal ownCloud classes
|
2013-09-10 21:34:38 +04:00
|
|
|
namespace OCP\Files;
|
2013-09-06 22:38:59 +04:00
|
|
|
|
2015-04-16 18:00:08 +03:00
|
|
|
/**
|
|
|
|
* Interface File
|
|
|
|
*
|
|
|
|
* @package OCP\Files
|
|
|
|
* @since 6.0.0
|
|
|
|
*/
|
2013-09-06 22:38:59 +04:00
|
|
|
interface File extends Node {
|
|
|
|
/**
|
2013-09-10 22:02:15 +04:00
|
|
|
* Get the content of the file as string
|
|
|
|
*
|
2013-09-06 22:38:59 +04:00
|
|
|
* @return string
|
2013-09-10 22:02:15 +04:00
|
|
|
* @throws \OCP\Files\NotPermittedException
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function getContent();
|
|
|
|
|
|
|
|
/**
|
2013-09-10 22:02:15 +04:00
|
|
|
* Write to the file from string data
|
|
|
|
*
|
2018-06-26 12:07:41 +03:00
|
|
|
* @param string|resource $data
|
2013-09-10 22:02:15 +04:00
|
|
|
* @throws \OCP\Files\NotPermittedException
|
2018-03-08 23:58:11 +03:00
|
|
|
* @throws \OCP\Files\GenericFileException
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function putContent($data);
|
|
|
|
|
|
|
|
/**
|
2013-09-10 22:02:15 +04:00
|
|
|
* Get the mimetype of the file
|
|
|
|
*
|
2013-09-06 22:38:59 +04:00
|
|
|
* @return string
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function getMimeType();
|
|
|
|
|
|
|
|
/**
|
2013-09-10 22:02:15 +04:00
|
|
|
* Open the file as stream, resulting resource can be operated as stream like the result from php's own fopen
|
|
|
|
*
|
2013-09-06 22:38:59 +04:00
|
|
|
* @param string $mode
|
|
|
|
* @return resource
|
2013-09-10 22:02:15 +04:00
|
|
|
* @throws \OCP\Files\NotPermittedException
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function fopen($mode);
|
|
|
|
|
|
|
|
/**
|
2013-09-10 22:02:15 +04:00
|
|
|
* Compute the hash of the file
|
|
|
|
* Type of hash is set with $type and can be anything supported by php's hash_file
|
|
|
|
*
|
2013-09-06 22:38:59 +04:00
|
|
|
* @param string $type
|
|
|
|
* @param bool $raw
|
|
|
|
* @return string
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function hash($type, $raw = false);
|
2016-02-08 16:44:26 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the stored checksum for this file
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
* @since 9.0.0
|
|
|
|
* @throws InvalidPathException
|
|
|
|
* @throws NotFoundException
|
|
|
|
*/
|
|
|
|
public function getChecksum();
|
2018-10-29 17:23:33 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the extension of this file
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
* @since 15.0.0
|
|
|
|
*/
|
|
|
|
public function getExtension(): string;
|
2013-09-06 22:38:59 +04:00
|
|
|
}
|