FileAccess is a seek-able countable PHP Iterator that acts too in part like
an ArrayObject.It meanly act as a read only ArrayObject that can't be sorted or modify.
Its main goal is to act as a flexible and inexpensive alternative to the PHP file function
providing more delimiter options.It actually have all the read-only file functions
and can help to iterate on a chosen format of file's chunks.
class FileAccess implements SeekableIterator,countable,ArrayAccess
{
protected
$fileHandle,
$delimiter,
$lines=[],
$length,
$flags,
$line,
$i=0,
$spl_info,
$spl_options,
$max_line_length,
$context,
$path;
public function __construct(string $fileName,string|integer|float $delimiter='\n',int $flags=0,resource $context=null) $delimiter can be a POSIX regex
public function rewind()
public function valid()
public function current()
public function key()
public function next()
public function prev()
public function eof()
public function end()
public function count()
public function offsetExists(int $offset)
public function offsetGet(int $offset)
public function offsetSet(int $offset,mixed $value)
public function offsetUnset(int $offset)
public function seek(int $offset)
public function ftell()
public function fseek(int $offset,int $whence=SEEK_SET)
public function fread(int $length)
public function fgets(int $length=null)
public function fgetc()
public function fgetss(int $length=null,string $allowable_tags='')
public function fscanf(string $format,&...$facultatives) Only for PHP >=5.6.0,open the class file and comment this method lines
if you use PHP < 5.6
public function fgetcsv(int $length = 0 ,string $delimiter = "," ,string $enclosure = '"' ,string $escape = "\\" )
public function reset()
public function fpassthru(
public function Filter_FileAccess() only usefull to act like PHP "file" function : filter with defined flags when $delimiter=='\n'
and return unfiltered data when !='\n'
public function getArrayCopy() return an array containing the iterator values(eg: when $delimiter is \n then the array will be the
same as the PHP file function output without flags skip_empty_lines and ignore_new_line
public function fstat()
public function length
public function max_chunk_length()
public function getMoreInfos() return new SplFileInfo object
public function getMoreOptions(string $mode="rb",boolean $use_include_path=false) return new SplFileObject object with read only mode
public function getMimeType()
public function getSha1(boolean $raw_output=false)
public function getMd5(boolean $raw_output=false)
public function __toString()
public function __destruct()
}
report bugs and improvements to leizmo@gmail.com or simply use the dedicated forum. |