com.jniwrapper.win32.io
Class FileSystem

java.lang.Object
  extended bycom.jniwrapper.win32.io.FileSystem

public class FileSystem
extends java.lang.Object


Nested Class Summary
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 Summary
FileSystem()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystem

public FileSystem()
Method Detail

getDriveType

public static FileSystem.DriveType getDriveType(java.lang.String diskName)
Returns the drive type of a specified disk.

Parameters:
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.
Returns:
the drive type specified in the FileSystem.DriveType enumeration class.

getDriveType

public static FileSystem.DriveType getDriveType(java.io.File drive)
Returns the drive type of a specefied disk.

Parameters:
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.
Returns:
drive type specified in the FileSystem.DriveType enumeration class.

getDiskFreeSpace

public static long getDiskFreeSpace(java.lang.String path)
Returns the amount of space available on the disk in bytes.

Parameters:
path - specifies the directory on the disk.
Returns:
the number of free bytes available on the disk.

getDiskFreeSpace

public static long getDiskFreeSpace(java.io.File path)
Returns the amount of space available on the disk in bytes.

Parameters:
path - specifies the directory on the disk.
Returns:
the number of free bytes available on the disk.

getDiskTotalSize

public static long getDiskTotalSize(java.lang.String path)
Returns the total size of the disk in bytes.

Parameters:
path - specifies the directory on the disk.
Returns:
the number of bytes available on the disk.

getDiskTotalSize

public static long getDiskTotalSize(java.io.File path)
Returns the total size of the disk in bytes.

Parameters:
path - specifies directory on the disk.
Returns:
the number of bytes available on the disk.

getFileAttributes

public static FileSystem.FileAttributes getFileAttributes(java.lang.String fileName)
Retrieves FileSystem.FileAttributes from the file specified by fileName.

Parameters:
fileName - is the file name.
Returns:
FileAttributes of a specified file.

getFileAttributes

public static FileSystem.FileAttributes getFileAttributes(java.io.File file)
Retrieves FileSystem.FileAttributes from the specified file.

Parameters:
file -
Returns:
FileAttributes of a specified file.

setFileAttributes

public static boolean setFileAttributes(java.lang.String fileName,
                                        FileSystem.FileAttributes attributes)
Sets attributes for the specified file.

Parameters:
fileName -
attributes - new file attributes
Returns:
if the function is executed successfully, the result is true; otherwise false.

setFileAttributes

public static boolean setFileAttributes(java.io.File file,
                                        FileSystem.FileAttributes attributes)
Sets attributes for the specified file.

Parameters:
file -
attributes - new file attributes
Returns:
if the function is executed successfully, the result is true; otherwise false.

getSerialNumber

public static long getSerialNumber(java.io.File drive)
This function retrieves Serial Number of any drive.

Parameters:
drive - drive to retrieve the SN for.
Returns:
serial number

getVolumeLabel

public static java.lang.String getVolumeLabel(java.io.File drive)
This function retrieves the volume label of the drive.

Parameters:
drive - the drive to retrieve the volume label for.
Returns:
the volume label