ReadInterface.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Filesystem\File;
  7. /**
  8. * Interface \Magento\Framework\Filesystem\File\ReadInterface
  9. *
  10. */
  11. interface ReadInterface
  12. {
  13. /**
  14. * Reads the specified number of bytes from the current position.
  15. *
  16. * @param int $length The number of bytes to read
  17. * @return string
  18. */
  19. public function read($length);
  20. /**
  21. * Returns the complete content of the file.
  22. *
  23. * @param string|null $flag
  24. * @param resource|null $context
  25. * @return string
  26. */
  27. public function readAll($flag = null, $context = null);
  28. /**
  29. * Reads the line with specified number of bytes from the current position.
  30. *
  31. * @param int $length The number of bytes to read
  32. * @param string $ending [optional]
  33. * @return string
  34. */
  35. public function readLine($length, $ending = null);
  36. /**
  37. * Reads one CSV row from the file
  38. *
  39. * @param int $length [optional] <p>
  40. * @param string $delimiter [optional]
  41. * @param string $enclosure [optional]
  42. * @param string $escape [optional]
  43. * @return array|bool false on end of file
  44. */
  45. public function readCsv($length = 0, $delimiter = ',', $enclosure = '"', $escape = '\\');
  46. /**
  47. * Returns the current position
  48. *
  49. * @return int
  50. */
  51. public function tell();
  52. /**
  53. * Seeks to the specified offset
  54. *
  55. * @param int $length
  56. * @param int $whence
  57. * @return int
  58. */
  59. public function seek($length, $whence = SEEK_SET);
  60. /**
  61. * Checks if the current position is the end-of-file
  62. *
  63. * @return bool
  64. */
  65. public function eof();
  66. /**
  67. * Closes the file.
  68. *
  69. * @return bool
  70. */
  71. public function close();
  72. /**
  73. * Get file properties.
  74. *
  75. * @return array
  76. */
  77. public function stat();
  78. }