Information on a file

Created by Path::stat and Path::link_stat.

The information within this class is gathered when the instance is initialized it will not be updated if the targeted file is modified.

Introduced properties

fun atime: Int

core :: FileStat :: atime

Returns the last access time
fun ctime: Int

core :: FileStat :: ctime

Returns the last status change time
fun is_blk: Bool

core :: FileStat :: is_blk

Is this a block device?
fun is_chr: Bool

core :: FileStat :: is_chr

Is this a character device?
fun is_dir: Bool

core :: FileStat :: is_dir

Is this a directory?
fun is_fifo: Bool

core :: FileStat :: is_fifo

Is this a FIFO pipe?
fun is_file: Bool

core :: FileStat :: is_file

Is self a regular file and not a device file, pipe, socket, etc.?
fun is_reg: Bool

core :: FileStat :: is_reg

Alias for is_file
fun is_sock: Bool

core :: FileStat :: is_sock

Is this a UNIX socket
fun last_access_time: Int

core :: FileStat :: last_access_time

Returns the last access time in seconds since Epoch
fun last_modification_time: Int

core :: FileStat :: last_modification_time

Returns the last modification time in seconds since Epoch
fun last_status_change_time: Int

core :: FileStat :: last_status_change_time

Returns the last status change time in seconds since Epoch
fun mode: Int

core :: FileStat :: mode

Returns the permission bits of file
fun mtime: Int

core :: FileStat :: mtime

Returns the last modification time
fun size: Int

core :: FileStat :: size

Size of the file at path

Redefined properties

redef type SELF: FileStat

core $ FileStat :: SELF

Type of this instance, automatically specialized in every class
redef fun finalize

core $ FileStat :: finalize

Liberate any resources held by self before the memory holding self is freed

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun atime: Int

core :: FileStat :: atime

Returns the last access time
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun ctime: Int

core :: FileStat :: ctime

Returns the last status change time
fun finalize

core :: Finalizable :: finalize

Liberate any resources held by self before the memory holding self is freed
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun is_blk: Bool

core :: FileStat :: is_blk

Is this a block device?
fun is_chr: Bool

core :: FileStat :: is_chr

Is this a character device?
fun is_dir: Bool

core :: FileStat :: is_dir

Is this a directory?
fun is_fifo: Bool

core :: FileStat :: is_fifo

Is this a FIFO pipe?
fun is_file: Bool

core :: FileStat :: is_file

Is self a regular file and not a device file, pipe, socket, etc.?
fun is_reg: Bool

core :: FileStat :: is_reg

Alias for is_file
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
fun is_sock: Bool

core :: FileStat :: is_sock

Is this a UNIX socket
fun last_access_time: Int

core :: FileStat :: last_access_time

Returns the last access time in seconds since Epoch
fun last_modification_time: Int

core :: FileStat :: last_modification_time

Returns the last modification time in seconds since Epoch
fun last_status_change_time: Int

core :: FileStat :: last_status_change_time

Returns the last status change time in seconds since Epoch
fun mode: Int

core :: FileStat :: mode

Returns the permission bits of file
fun mtime: Int

core :: FileStat :: mtime

Returns the last modification time
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun size: Int

core :: FileStat :: size

Size of the file at path
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
package_diagram core::FileStat FileStat core::Finalizable Finalizable core::FileStat->core::Finalizable core::Object Object core::Finalizable->core::Object ...core::Object ... ...core::Object->core::Object

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

class Finalizable

core :: Finalizable

An object needing finalization

Class definitions

core $ FileStat
# Information on a file
#
# Created by `Path::stat` and `Path::link_stat`.
#
# The information within this class is gathered when the instance is initialized
# it will not be updated if the targeted file is modified.
class FileStat
	super Finalizable

	# TODO private init

	# The low-level status of a file
	#
	# See: POSIX stat(2)
	private var stat: NativeFileStat

	private var finalized = false

	redef fun finalize
	do
		if not finalized then
			stat.free
			finalized = true
		end
	end

	# Returns the last access time in seconds since Epoch
	fun last_access_time: Int
	do
		assert not finalized
		return stat.atime
	end

	# Returns the last access time
	#
	# alias for `last_access_time`
	fun atime: Int do return last_access_time

	# Returns the last modification time in seconds since Epoch
	fun last_modification_time: Int
	do
		assert not finalized
		return stat.mtime
	end

	# Returns the last modification time
	#
	# alias for `last_modification_time`
	fun mtime: Int do return last_modification_time


	# Size of the file at `path`
	fun size: Int
	do
		assert not finalized
		return stat.size
	end

	# Is self a regular file and not a device file, pipe, socket, etc.?
	fun is_file: Bool
	do
		assert not finalized
		return stat.is_reg
	end

	# Alias for `is_file`
	fun is_reg: Bool do return is_file

	# Is this a directory?
	fun is_dir: Bool
	do
		assert not finalized
		return stat.is_dir
	end

	# Is this a symbolic link?
	fun is_link: Bool
	do
		assert not finalized
		return stat.is_lnk
	end

	# FIXME Make the following POSIX only? or implement in some other way on Windows

	# Returns the last status change time in seconds since Epoch
	fun last_status_change_time: Int
	do
		assert not finalized
		return stat.ctime
	end

	# Returns the last status change time
	#
	# alias for `last_status_change_time`
	fun ctime: Int do return last_status_change_time

	# Returns the permission bits of file
	fun mode: Int
	do
		assert not finalized
		return stat.mode
	end

	# Is this a character device?
	fun is_chr: Bool
	do
		assert not finalized
		return stat.is_chr
	end

	# Is this a block device?
	fun is_blk: Bool
	do
		assert not finalized
		return stat.is_blk
	end

	# Is this a FIFO pipe?
	fun is_fifo: Bool
	do
		assert not finalized
		return stat.is_fifo
	end

	# Is this a UNIX socket
	fun is_sock: Bool
	do
		assert not finalized
		return stat.is_sock
	end
end
lib/core/file.nit:760,1--890,3