POMO_FileReader

The WordPress Core POMO FileReader class.

Defined (1)

The class is defined in the following location(s).

/wp-includes/pomo/streams.php  
  1. class POMO_FileReader extends POMO_Reader { 
  2.  
  3. /** 
  4. * @param string $filename 
  5. */ 
  6. function __construct( $filename ) { 
  7. parent::POMO_Reader(); 
  8. $this->_f = fopen($filename, 'rb'); 
  9.  
  10. /** 
  11. * PHP4 constructor. 
  12. */ 
  13. public function POMO_FileReader( $filename ) { 
  14. self::__construct( $filename ); 
  15.  
  16. /** 
  17. * @param int $bytes 
  18. */ 
  19. function read($bytes) { 
  20. return fread($this->_f, $bytes); 
  21.  
  22. /** 
  23. * @param int $pos 
  24. * @return boolean 
  25. */ 
  26. function seekto($pos) { 
  27. if ( -1 == fseek($this->_f, $pos, SEEK_SET)) { 
  28. return false; 
  29. $this->_pos = $pos; 
  30. return true; 
  31.  
  32. /** 
  33. * @return bool 
  34. */ 
  35. function is_resource() { 
  36. return is_resource($this->_f); 
  37.  
  38. /** 
  39. * @return bool 
  40. */ 
  41. function feof() { 
  42. return feof($this->_f); 
  43.  
  44. /** 
  45. * @return bool 
  46. */ 
  47. function close() { 
  48. return fclose($this->_f); 
  49.  
  50. /** 
  51. * @return string 
  52. */ 
  53. function read_all() { 
  54. $all = ''; 
  55. while ( !$this->feof() ) 
  56. $all .= $this->read(4096); 
  57. return $all;