2013-09-06 22:38:59 +04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
2013-09-10 21:34:38 +04:00
|
|
|
namespace OCP\Files;
|
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
|
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
|
|
|
|
*
|
2013-09-06 22:38:59 +04:00
|
|
|
* @param string $data
|
2013-09-10 22:02:15 +04:00
|
|
|
* @throws \OCP\Files\NotPermittedException
|
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
|
|
|
|
*/
|
|
|
|
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
|
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
|
|
|
|
*/
|
|
|
|
public function hash($type, $raw = false);
|
|
|
|
}
|