FileHandler
class FileHandler
User as file handle by streamWrapper implementation.
This class is responsible mainly for managing the pointer position during reading and writing.
Constants
READ_MODE |
|
WRITE_MODE |
|
Methods
Sets file in context.
Writes data to file. Will return the number of bytes written. Will advance pointer by number of bytes written.
Will read and return $bytes bytes from file. Will advance pointer by $bytes bytes.
Returns current pointer position.
Moves pointer to the end of file (for append modes).
Offsets position by $offset
Tells whether pointer is at the end of file.
Removed all data from file and sets pointer to 0
Sets handler to read only
Sets handler into read/write mode
No description
Checks if pointer allows writing
Checks if pointer allows reading
No description
Details
at line 42
setFile(File $file)
Sets file in context.
at line 54
int
write(string $data)
Writes data to file. Will return the number of bytes written. Will advance pointer by number of bytes written.
at line 75
string
read(int $bytes)
Will read and return $bytes bytes from file. Will advance pointer by $bytes bytes.
at line 98
int
position(integer|null $position = null)
Returns current pointer position.
at line 108
int
seekToEnd()
Moves pointer to the end of file (for append modes).
at line 118
offsetPosition(int $offset)
Offsets position by $offset
at line 128
bool
atEof()
Tells whether pointer is at the end of file.
at line 140
void
truncate(int $newSize)
Removed all data from file and sets pointer to 0
at line 155
setReadOnlyMode()
Sets handler to read only
at line 163
setReadWriteMode()
Sets handler into read/write mode
at line 168
setWriteOnlyMode()
at line 178
bool
isOpenedForWriting()
Checks if pointer allows writing
at line 188
bool
isOpenedForReading()
Checks if pointer allows reading