Class

File

Package: IO\Filesystem Copyright: © 2005-2019 PHPBoost License: GNU/GPL-3.0 Author: Nicolas Duhamel akhenathon2@gmail.com Version: PHPBoost 5.2 - last update: 2019 03 27 Since: PHPBoost 2.0 - 2008 07 06 Contributor: Loic ROUCHON horn@phpboost.com Contributor: Benoit SAUTEL ben.popeye@phpboost.com Contributor: Julien BRISWALTER j1.seth@phpboost.com Contributor: Arnaud GENET elenwii@phpboost.com Located at: io/filesystem/File.class.php

This class represents a text file which can be read and written.

FileSystemElement
Extended by File
Methods summary
public
# __construct( string $path, integer $mode,…, boolean $whenopen,… )

Builds a File object.

public
public string
# get_name_without_extension( )

Returns the element name without extension.

public string
# get_extension( )

Returns the extension of the element.

public string
# read( integer $start = 0, integer $len = -1 )

Returns the content of the file.

public string[]
# read_lines( )

Returns the content of the file grouped by lines.

public
# write( string $data )

Writes some text in the file. Erases the file previous content

public
# append( string $data )

Appends some text at the end of the file.

public
# erase( )

empty the file

public
# close( )

Closes a file and frees the allocated memory relative to the file.

public
# delete( )

Deletes the file.

public
# lock( boolean $blocking = true )
public
# unlock( )

Unlocks a file. The file must have been locked before you call this method.

public
# flush( )

Forces the system to write all the buffered output.

public integer
# get_last_modification_date( )

Returns the date of the last modification of the file.

public integer
# get_last_access_date( )

Returns the last access date of the file.

public integer
# get_file_size( )

Returns the size of the file.

public
# open( $mode )

Opens the file. You cannot read or write a closed file, use this method to open it.

public static string
# get_file_checksum( string $filename )

Get file checksum in sha256.

Constants summary
integer READ
# 0x1
integer WRITE
# 0x2
integer APPEND
# 0x3
Properties inherited from FileSystemElement
$path