Record Class FileAttributes
java.lang.Object
java.lang.Record
dan200.computercraft.api.filesystem.FileAttributes
- Record Components:
isDirectory
- Whether this filesystem entry is a directory.size
- The size of the file.creationTime
- The time the file was created.lastModifiedTime
- The time the file was last modified.
- All Implemented Interfaces:
BasicFileAttributes
public record FileAttributes(boolean isDirectory, long size, FileTime creationTime, FileTime lastModifiedTime)
extends Record
implements BasicFileAttributes
A simple version of
BasicFileAttributes
, which provides what information a Mount
already exposes.-
Constructor Summary
ConstructorsConstructorDescriptionFileAttributes
(boolean isDirectory, long size) Create a newFileAttributes
instance with the creation time and last modified time set to the Unix epoch.FileAttributes
(boolean isDirectory, long size, FileTime creationTime, FileTime lastModifiedTime) Creates an instance of aFileAttributes
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecreationTime
record component.final boolean
Indicates whether some other object is "equal to" this one.@Nullable Object
fileKey()
final int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of theisDirectory
record component.boolean
isOther()
boolean
boolean
Returns the value of thelastModifiedTime
record component.long
size()
Returns the value of thesize
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
FileAttributes
public FileAttributes(boolean isDirectory, long size) Create a newFileAttributes
instance with the creation time and last modified time set to the Unix epoch.- Parameters:
isDirectory
- Whether the filesystem entry is a directory.size
- The size of the file.
-
FileAttributes
public FileAttributes(boolean isDirectory, long size, FileTime creationTime, FileTime lastModifiedTime) Creates an instance of aFileAttributes
record class.- Parameters:
isDirectory
- the value for theisDirectory
record componentsize
- the value for thesize
record componentcreationTime
- the value for thecreationTime
record componentlastModifiedTime
- the value for thelastModifiedTime
record component
-
-
Method Details
-
lastAccessTime
- Specified by:
lastAccessTime
in interfaceBasicFileAttributes
-
isRegularFile
public boolean isRegularFile()- Specified by:
isRegularFile
in interfaceBasicFileAttributes
-
isSymbolicLink
public boolean isSymbolicLink()- Specified by:
isSymbolicLink
in interfaceBasicFileAttributes
-
isOther
public boolean isOther()- Specified by:
isOther
in interfaceBasicFileAttributes
-
fileKey
- Specified by:
fileKey
in interfaceBasicFileAttributes
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
isDirectory
public boolean isDirectory()Returns the value of theisDirectory
record component.- Specified by:
isDirectory
in interfaceBasicFileAttributes
- Returns:
- the value of the
isDirectory
record component
-
size
public long size()Returns the value of thesize
record component.- Specified by:
size
in interfaceBasicFileAttributes
- Returns:
- the value of the
size
record component
-
creationTime
Returns the value of thecreationTime
record component.- Specified by:
creationTime
in interfaceBasicFileAttributes
- Returns:
- the value of the
creationTime
record component
-
lastModifiedTime
Returns the value of thelastModifiedTime
record component.- Specified by:
lastModifiedTime
in interfaceBasicFileAttributes
- Returns:
- the value of the
lastModifiedTime
record component
-