public class FileSystem
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
FileSystem.DriveType
DriveTypes class represents the enumeration of drive types.
|
static class |
FileSystem.FileAttributes
FileAttributes class represents a set of file attributes.
|
Constructor and Description |
---|
FileSystem() |
Modifier and Type | Method and Description |
---|---|
static long |
getDiskFreeSpace(java.io.File path)
Returns the amount of space available on the disk in bytes.
|
static long |
getDiskFreeSpace(java.lang.String path)
Returns the amount of space available on the disk in bytes.
|
static long |
getDiskTotalSize(java.io.File path)
Returns the total size of the disk in bytes.
|
static long |
getDiskTotalSize(java.lang.String path)
Returns the total size of the disk in bytes.
|
static FileSystem.DriveType |
getDriveType(java.io.File drive)
Returns the drive type of a specefied disk.
|
static FileSystem.DriveType |
getDriveType(java.lang.String diskName)
Returns the drive type of a specified disk.
|
static FileSystem.FileAttributes |
getFileAttributes(java.io.File file)
Retrieves
FileSystem.FileAttributes from the specified file. |
static FileSystem.FileAttributes |
getFileAttributes(java.lang.String fileName)
Retrieves
FileSystem.FileAttributes from the file specified by fileName. |
static long |
getSerialNumber(java.io.File drive)
This function retrieves Serial Number of any drive.
|
static java.lang.String |
getVolumeLabel(java.io.File drive)
This function retrieves the volume label of the drive.
|
static boolean |
setFileAttributes(java.io.File file,
FileSystem.FileAttributes attributes)
Sets attributes for the specified file.
|
static boolean |
setFileAttributes(java.lang.String fileName,
FileSystem.FileAttributes attributes)
Sets attributes for the specified file.
|
public static FileSystem.DriveType getDriveType(java.lang.String diskName)
diskName
- is a drive letter like A:\, C:\ etc. i.e. root folder. If
the passed path is not a root folder, the function will not determine the drive type
and will return DRIVE_NO_ROOT_DIR type.FileSystem.DriveType
enumeration class.public static FileSystem.DriveType getDriveType(java.io.File drive)
drive
- is a root file like A:\, C:\ etc., otherwise if the passed
file is not a root folder, the function will not determine the drive type and will
return DRIVE_NO_ROOT_DIR type.FileSystem.DriveType
enumeration class.public static long getDiskFreeSpace(java.lang.String path)
path
- specifies the directory on the disk.public static long getDiskFreeSpace(java.io.File path)
path
- specifies the directory on the disk.public static long getDiskTotalSize(java.lang.String path)
path
- specifies the directory on the disk.public static long getDiskTotalSize(java.io.File path)
path
- specifies directory on the disk.public static FileSystem.FileAttributes getFileAttributes(java.lang.String fileName)
FileSystem.FileAttributes
from the file specified by fileName.fileName
- is the file name.public static FileSystem.FileAttributes getFileAttributes(java.io.File file)
FileSystem.FileAttributes
from the specified file.file
- public static boolean setFileAttributes(java.lang.String fileName, FileSystem.FileAttributes attributes)
fileName
- attributes
- new file attributespublic static boolean setFileAttributes(java.io.File file, FileSystem.FileAttributes attributes)
file
- attributes
- new file attributespublic static long getSerialNumber(java.io.File drive)
drive
- drive to retrieve the SN for.public static java.lang.String getVolumeLabel(java.io.File drive)
drive
- the drive to retrieve the volume label for.