Changeset 880 for trunk/includes/FileStream.php
- Timestamp:
- Apr 7, 2020, 10:15:48 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/FileStream.php
r815 r880 15 15 function __destruct() 16 16 { 17 if ($this->Handle)17 if ($this->Handle) 18 18 fclose($this->Handle); 19 19 } … … 24 24 $this->CloseFile(); 25 25 $this->Handle = fopen($FileName, 'rb'); 26 if (!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));26 if (!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND)); 27 27 } 28 28 … … 32 32 $this->CloseFile(); 33 33 $this->Handle = fopen($FileName, 'wb+'); 34 if (!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));34 if (!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND)); 35 35 } 36 36 37 37 public function CloseFile() 38 38 { 39 if ($this->Handle)39 if ($this->Handle) 40 40 fclose($this->Handle); 41 41 } … … 43 43 public function ReadBlock($Count) 44 44 { 45 return (fread($this->Handle, $Count));45 return fread($this->Handle, $Count); 46 46 } 47 47 48 48 public function ReadByte() 49 49 { 50 return (fread($this->Handle, 1));50 return fread($this->Handle, 1); 51 51 } 52 52 … … 54 54 { 55 55 $val = unpack('V*', fread($this->Handle, 4)); 56 return ($val[1]);56 return $val[1]; 57 57 } 58 58 … … 60 60 { 61 61 $val = unpack('I*', fread($this->Handle, 4)); 62 return ($val[1]);62 return $val[1]; 63 63 } 64 64 … … 66 66 { 67 67 $val = unpack('f*', fread($this->Handle, 4)); 68 return ($val[1]);68 return $val[1]; 69 69 } 70 70 71 71 public function ReadChar() 72 72 { 73 return (fread($this->Handle, 1));73 return fread($this->Handle, 1); 74 74 } 75 75 76 76 public function ReadLine() 77 77 { 78 return (fgets($this->Handle));78 return fgets($this->Handle); 79 79 } 80 80 81 81 public function ReadTextLine() 82 82 { 83 return (fgets($this->Handle));83 return fgets($this->Handle); 84 84 } 85 85 … … 131 131 public function GetPosition() 132 132 { 133 return (ftell($this->Handle));133 return ftell($this->Handle); 134 134 } 135 135 136 136 public function GetSize() 137 137 { 138 return (filesize($this->FileName));138 return filesize($this->FileName); 139 139 } 140 140 141 141 public function SetSize($Size) 142 142 { 143 return (ftruncate($this->Handle, $Size));143 return ftruncate($this->Handle, $Size); 144 144 } 145 145 146 146 public function EOF() 147 147 { 148 return (feof($this->Handle));148 return feof($this->Handle); 149 149 } 150 150 }
Note:
See TracChangeset
for help on using the changeset viewer.