ISimpleFile.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Roeland Jago Douma <roeland@famdouma.nl>
  4. *
  5. * @author Roeland Jago Douma <roeland@famdouma.nl>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. namespace OCP\Files\SimpleFS;
  24. use OCP\Files\NotFoundException;
  25. use OCP\Files\NotPermittedException;
  26. /**
  27. * Interface ISimpleFile
  28. *
  29. * @package OCP\Files\SimpleFS
  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. * @since 11.0.0
  76. */
  77. public function putContent($data);
  78. /**
  79. * Delete the file
  80. *
  81. * @throws NotPermittedException
  82. * @since 11.0.0
  83. */
  84. public function delete();
  85. /**
  86. * Get the MimeType
  87. *
  88. * @return string
  89. * @since 11.0.0
  90. */
  91. public function getMimeType();
  92. /**
  93. * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen
  94. *
  95. * @return resource
  96. * @throws \OCP\Files\NotPermittedException
  97. * @since 14.0.0
  98. */
  99. public function read();
  100. /**
  101. * Open the file as stream for writing, resulting resource can be operated as stream like the result from php's own fopen
  102. *
  103. * @return resource
  104. * @throws \OCP\Files\NotPermittedException
  105. * @since 14.0.0
  106. */
  107. public function write();
  108. }