Top Inners Fields Constructors Methods
jnr.posix

public Class JavaFileStat

extends AbstractJavaFileStat
Class Inheritance
Imports
java.io.File, .IOException, java.nio.file.Files, .LinkOption, .Path, java.nio.file.attribute.BasicFileAttributes, .DosFileAttributes, .FileTime, .PosixFileAttributes, .PosixFilePermission, java.util.Set

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
pack-priv BasicFileAttributes
pack-priv DosFileAttributes
pack-priv PosixFileAttributes
pack-priv short
Inherited from jnr.posix.AbstractJavaFileStat:
handlerposix

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public long
atime()

Implements jnr.posix.FileStat.atime.

Limitation: Java has no access time support, so we return mtime as the next best thing.
private short
calculateMode(File file, short st_mode)

public long
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public int
public long
public void
setup(String filePath)

public long
st_size()

Implements jnr.posix.FileStat.st_size.

Note

Name 'st_size' since Structure has a 'size' method already

Inherited from jnr.posix.AbstractJavaFileStat:
blocksblockSizedevftypegidgroupMemberinoisBlockDevisCharDevisFifoisNamedPipeisSetgidisSetuidisSocketisStickymajorminornlinkrdevuid

Field Detail

attrsback to summary
pack-priv BasicFileAttributes attrs
dosAttrsback to summary
pack-priv DosFileAttributes dosAttrs
posixAttrsback to summary
pack-priv PosixFileAttributes posixAttrs
st_modeback to summary
pack-priv short st_mode

Constructor Detail

JavaFileStatback to summary
public JavaFileStat(POSIX posix, POSIXHandler handler)

Method Detail

atimeback to summary
public long atime()

Implements jnr.posix.FileStat.atime.

Limitation: Java has no access time support, so we return mtime as the next best thing.

calculateModeback to summary
private short calculateMode(File file, short st_mode)
ctimeback to summary
public long ctime()

Implements jnr.posix.FileStat.ctime.

isDirectoryback to summary
public boolean isDirectory()

Implements jnr.posix.FileStat.isDirectory.

isEmptyback to summary
public boolean isEmpty()

Implements jnr.posix.FileStat.isEmpty.

isExecutableback to summary
public boolean isExecutable()

Implements jnr.posix.FileStat.isExecutable.

isExecutableRealback to summary
public boolean isExecutableReal()

Implements jnr.posix.FileStat.isExecutableReal.

isFileback to summary
public boolean isFile()

Implements jnr.posix.FileStat.isFile.

isGroupOwnedback to summary
public boolean isGroupOwned()

Implements jnr.posix.FileStat.isGroupOwned.

isIdenticalback to summary
public boolean isIdentical(FileStat other)

Implements jnr.posix.FileStat.isIdentical.

isOwnedback to summary
public boolean isOwned()

Implements jnr.posix.FileStat.isOwned.

isReadableback to summary
public boolean isReadable()

Implements jnr.posix.FileStat.isReadable.

isReadableRealback to summary
public boolean isReadableReal()

Implements jnr.posix.FileStat.isReadableReal.

isROwnedback to summary
public boolean isROwned()

Implements jnr.posix.FileStat.isROwned.

isWritableback to summary
public boolean isWritable()

Implements jnr.posix.FileStat.isWritable.

isWritableRealback to summary
public boolean isWritableReal()

Implements jnr.posix.FileStat.isWritableReal.

modeback to summary
public int mode()

Implements jnr.posix.FileStat.mode.

mtimeback to summary
public long mtime()

Implements jnr.posix.FileStat.mtime.

setupback to summary
public void setup(String filePath)
st_sizeback to summary
public long st_size()

Implements jnr.posix.FileStat.st_size.

Doc from jnr.posix.FileStat.st_size.

Note

Name 'st_size' since Structure has a 'size' method already

Returns:long

size of the stat structure

jnr.posix back to summary

private Class JavaFileStat.PreNIO2FileAttributes

extends Object
implements BasicFileAttributes
Class Inheritance
All Implemented Interfaces
java.nio.file.attribute.BasicFileAttributes

Field Summary

Modifier and TypeField and Description
pack-priv final boolean
pack-priv final boolean
pack-priv final int
pack-priv final int
pack-priv final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public FileTime
public Object
fileKey()

Implements java.nio.file.attribute.BasicFileAttributes.fileKey.

Returns an object that uniquely identifies the given file, or null if a file key is not available.
public boolean
isDirectory()

Implements java.nio.file.attribute.BasicFileAttributes.isDirectory.

Tells whether the file is a directory.
public boolean
isOther()

Implements java.nio.file.attribute.BasicFileAttributes.isOther.

Tells whether the file is something other than a regular file, directory, or symbolic link.
public boolean
isRegularFile()

Implements java.nio.file.attribute.BasicFileAttributes.isRegularFile.

Tells whether the file is a regular file with opaque content.
public FileTime
lastAccessTime()

Implements java.nio.file.attribute.BasicFileAttributes.lastAccessTime.

Returns the time of last access.
public FileTime
lastModifiedTime()

Implements java.nio.file.attribute.BasicFileAttributes.lastModifiedTime.

Returns the time of last modification.
public long
size()

Implements java.nio.file.attribute.BasicFileAttributes.size.

Returns the size of the file (in bytes).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

directoryback to summary
pack-priv final boolean directory
regularFileback to summary
pack-priv final boolean regularFile
st_ctimeback to summary
pack-priv final int st_ctime
st_mtimeback to summary
pack-priv final int st_mtime
st_sizeback to summary
pack-priv final long st_size

Constructor Detail

PreNIO2FileAttributesback to summary
pack-priv PreNIO2FileAttributes(File file)

Method Detail

creationTimeback to summary
public FileTime creationTime()

Implements java.nio.file.attribute.BasicFileAttributes.creationTime.

Doc from java.nio.file.attribute.BasicFileAttributes.creationTime.

Returns the creation time. The creation time is the time that the file was created.

If the file system implementation does not support a time stamp to indicate the time when the file was created then this method returns an implementation specific default value, typically the last-modified-time or a FileTime representing the epoch (1970-01-01T00:00:00Z).

Returns:FileTime

a FileTime representing the time the file was created

Annotations
@Override
fileKeyback to summary
public Object fileKey()

Implements java.nio.file.attribute.BasicFileAttributes.fileKey.

Doc from java.nio.file.attribute.BasicFileAttributes.fileKey.

Returns an object that uniquely identifies the given file, or null if a file key is not available. On some platforms or file systems it is possible to use an identifier, or a combination of identifiers to uniquely identify a file. Such identifiers are important for operations such as file tree traversal in file systems that support symbolic links or file systems that allow a file to be an entry in more than one directory. On UNIX file systems, for example, the device ID and inode are commonly used for such purposes.

The file key returned by this method can only be guaranteed to be unique if the file system and files remain static. Whether a file system re-uses identifiers after a file is deleted is implementation dependent and therefore unspecified.

File keys returned by this method can be compared for equality and are suitable for use in collections. If the file system and files remain static, and two files are the same with non-null file keys, then their file keys are equal.

Returns:Object

an object that uniquely identifies the given file, or null

Annotations
@Override
isDirectoryback to summary
public boolean isDirectory()

Implements java.nio.file.attribute.BasicFileAttributes.isDirectory.

Doc from java.nio.file.attribute.BasicFileAttributes.isDirectory.

Tells whether the file is a directory.

Returns:boolean

true if the file is a directory

Annotations
@Override
isOtherback to summary
public boolean isOther()

Implements java.nio.file.attribute.BasicFileAttributes.isOther.

Doc from java.nio.file.attribute.BasicFileAttributes.isOther.

Tells whether the file is something other than a regular file, directory, or symbolic link.

Returns:boolean

true if the file something other than a regular file, directory or symbolic link

Annotations
@Override
isRegularFileback to summary
public boolean isRegularFile()

Implements java.nio.file.attribute.BasicFileAttributes.isRegularFile.

Doc from java.nio.file.attribute.BasicFileAttributes.isRegularFile.

Tells whether the file is a regular file with opaque content.

Returns:boolean

true if the file is a regular file with opaque content

Annotations
@Override
lastAccessTimeback to summary
public FileTime lastAccessTime()

Implements java.nio.file.attribute.BasicFileAttributes.lastAccessTime.

Doc from java.nio.file.attribute.BasicFileAttributes.lastAccessTime.

Returns the time of last access.

If the file system implementation does not support a time stamp to indicate the time of last access then this method returns an implementation specific default value, typically the last-modified-time or a FileTime representing the epoch (1970-01-01T00:00:00Z).

Returns:FileTime

a FileTime representing the time of last access

Annotations
@Override
lastModifiedTimeback to summary
public FileTime lastModifiedTime()

Implements java.nio.file.attribute.BasicFileAttributes.lastModifiedTime.

Doc from java.nio.file.attribute.BasicFileAttributes.lastModifiedTime.

Returns the time of last modification.

If the file system implementation does not support a time stamp to indicate the time of last modification then this method returns an implementation specific default value, typically a FileTime representing the epoch (1970-01-01T00:00:00Z).

Returns:FileTime

a FileTime representing the time the file was last modified

Annotations
@Override
sizeback to summary
public long size()

Implements java.nio.file.attribute.BasicFileAttributes.size.

Doc from java.nio.file.attribute.BasicFileAttributes.size.

Returns the size of the file (in bytes). The size may differ from the actual size on the file system due to compression, support for sparse files, or other reasons. The size of files that are not regular files is implementation specific and therefore unspecified.

Returns:long

the file size, in bytes

Annotations
@Override