file.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  4. * @author Morris Jobke <hey@morrisjobke.de>
  5. * @author Robin Appelman <icewind@owncloud.com>
  6. * @author Roeland Jago Douma <rullzer@owncloud.com>
  7. *
  8. * @copyright Copyright (c) 2016, ownCloud, Inc.
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. /**
  25. * Public interface of ownCloud for apps to use.
  26. * Files/File interface
  27. */
  28. // use OCP namespace for all classes that are considered public.
  29. // This means that they should be used by apps instead of the internal ownCloud classes
  30. namespace OCP\Files;
  31. /**
  32. * Interface File
  33. *
  34. * @package OCP\Files
  35. * @since 6.0.0
  36. */
  37. interface File extends Node {
  38. /**
  39. * Get the content of the file as string
  40. *
  41. * @return string
  42. * @throws \OCP\Files\NotPermittedException
  43. * @since 6.0.0
  44. */
  45. public function getContent();
  46. /**
  47. * Write to the file from string data
  48. *
  49. * @param string $data
  50. * @throws \OCP\Files\NotPermittedException
  51. * @return void
  52. * @since 6.0.0
  53. */
  54. public function putContent($data);
  55. /**
  56. * Get the mimetype of the file
  57. *
  58. * @return string
  59. * @since 6.0.0
  60. */
  61. public function getMimeType();
  62. /**
  63. * Open the file as stream, resulting resource can be operated as stream like the result from php's own fopen
  64. *
  65. * @param string $mode
  66. * @return resource
  67. * @throws \OCP\Files\NotPermittedException
  68. * @since 6.0.0
  69. */
  70. public function fopen($mode);
  71. /**
  72. * Compute the hash of the file
  73. * Type of hash is set with $type and can be anything supported by php's hash_file
  74. *
  75. * @param string $type
  76. * @param bool $raw
  77. * @return string
  78. * @since 6.0.0
  79. */
  80. public function hash($type, $raw = false);
  81. /**
  82. * Get the stored checksum for this file
  83. *
  84. * @return string
  85. * @since 9.0.0
  86. * @throws InvalidPathException
  87. * @throws NotFoundException
  88. */
  89. public function getChecksum();
  90. }