You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
2.5 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Roeland Jago Douma <roeland@famdouma.nl>
  4. *
  5. * @author Julius Härtl <jus@bitgrid.net>
  6. * @author Roeland Jago Douma <roeland@famdouma.nl>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  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
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\Files\SimpleFS;
  25. use OCP\Files\NotFoundException;
  26. use OCP\Files\NotPermittedException;
  27. /**
  28. * Interface ISimpleFile
  29. *
  30. * @since 11.0.0
  31. */
  32. interface ISimpleFile {
  33. /**
  34. * Get the name
  35. *
  36. * @return string
  37. * @since 11.0.0
  38. */
  39. public function getName();
  40. /**
  41. * Get the size in bytes
  42. *
  43. * @return int
  44. * @since 11.0.0
  45. */
  46. public function getSize();
  47. /**
  48. * Get the ETag
  49. *
  50. * @return string
  51. * @since 11.0.0
  52. */
  53. public function getETag();
  54. /**
  55. * Get the last modification time
  56. *
  57. * @return int
  58. * @since 11.0.0
  59. */
  60. public function getMTime();
  61. /**
  62. * Get the content
  63. *
  64. * @throws NotPermittedException
  65. * @throws NotFoundException
  66. * @return string
  67. * @since 11.0.0
  68. */
  69. public function getContent();
  70. /**
  71. * Overwrite the file
  72. *
  73. * @param string|resource $data
  74. * @throws NotPermittedException
  75. * @throws NotFoundException
  76. * @since 11.0.0
  77. */
  78. public function putContent($data);
  79. /**
  80. * Delete the file
  81. *
  82. * @throws NotPermittedException
  83. * @since 11.0.0
  84. */
  85. public function delete();
  86. /**
  87. * Get the MimeType
  88. *
  89. * @return string
  90. * @since 11.0.0
  91. */
  92. public function getMimeType();
  93. /**
  94. * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen
  95. *
  96. * @return resource
  97. * @throws \OCP\Files\NotPermittedException
  98. * @since 14.0.0
  99. */
  100. public function read();
  101. /**
  102. * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
  103. *
  104. * @return resource
  105. * @throws \OCP\Files\NotPermittedException
  106. * @since 14.0.0
  107. */
  108. public function write();
  109. }