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.

ISimpleFile.php 2.6KB

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