Servertec
Foundation Classes
1.3.3 09/04/2005

stec.sfc.Win32
Class Drive

java.lang.Object
  extended by stec.sfc.Win32.Drive

public final class Drive
extends java.lang.Object

Used to access drive information and set drive volume label.

Since:
1.0.0 01/07/2001

Constructor Summary
Drive(java.lang.String drive)
          Constructs a new Drive object for the specified drive.
Drive(java.lang.String drive, boolean check_drive)
          Constructs a new Drive object for the specified drive.
 
Method Summary
 int getBytesPerSector()
          Returns the number of bytes per sector.
 int getFileSystemFlags()
          Returns the file FileSystemFlag.
 java.lang.String getFileSystemName()
          Returns the file system's name.
 int getMaximumPathComponentLength()
          Returns the maximum path component length.
 int getNumberOfFreeClusters()
          Returns the number of free clusters.
 int getSectorsPerCluster()
          Returns the number of sectors per cluster.
 long getTotalNumberOfBytes()
          Returns the total number of bytes.
 int getTotalNumberOfClusters()
          Returns the number of clusters.
 long getTotalNumberOfFreeBytes()
          Returns the total number of free bytes.
 int getType()
          Returns the drive type.
 java.lang.String getVolumeLabel()
          Returns the volume label.
 int getVolumeSerialNumber()
          Returns the volume's serial number.
 void setVolumeLabel(java.lang.String label)
          Sets the volume label.
 java.lang.String toString()
          Returns the drive specifier.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Drive

public Drive(java.lang.String drive)
      throws Win32Exception
Constructs a new Drive object for the specified drive.

Parameters:
drive - the drive specifier.
Throws:
Win32Exception - if the drive does not exist or is not accessible or if any error occurs.

Drive

public Drive(java.lang.String drive,
             boolean check_drive)
      throws Win32Exception
Constructs a new Drive object for the specified drive.

Parameters:
drive - the drive specifier.
check_drive - whether to check if the drive exist or is accessible.
Throws:
Win32Exception - if the drive does not exist or is not accessible or if any error occurs.
Since:
1.1.3 09/08/2002
Method Detail

getType

public final int getType()
Returns the drive type.

Returns:
the drive type.
See Also:
DriveType

getSectorsPerCluster

public final int getSectorsPerCluster()
                               throws Win32Exception
Returns the number of sectors per cluster.

Returns:
the number of sectors per cluster.
Throws:
Win32Exception - if any error occurs.

getBytesPerSector

public final int getBytesPerSector()
                            throws Win32Exception
Returns the number of bytes per sector.

Returns:
the number of bytes per sector.
Throws:
Win32Exception - if any error occurs.

getNumberOfFreeClusters

public final int getNumberOfFreeClusters()
                                  throws Win32Exception
Returns the number of free clusters.

Returns:
the number of free clusters.
Throws:
Win32Exception - if any error occurs.

getTotalNumberOfClusters

public final int getTotalNumberOfClusters()
                                   throws Win32Exception
Returns the number of clusters.

Returns:
the number of clusters.
Throws:
Win32Exception - if any error occurs.

getTotalNumberOfBytes

public final long getTotalNumberOfBytes()
                                 throws Win32Exception
Returns the total number of bytes.

Returns:
the total number of bytes.
Throws:
Win32Exception - if any error occurs.

getTotalNumberOfFreeBytes

public final long getTotalNumberOfFreeBytes()
                                     throws Win32Exception
Returns the total number of free bytes.

Returns:
the total number of free bytes.
Throws:
Win32Exception - if any error occurs.

getVolumeLabel

public final java.lang.String getVolumeLabel()
                                      throws Win32Exception
Returns the volume label.

Returns:
the volume label.
Throws:
Win32Exception - if any error occurs.

setVolumeLabel

public final void setVolumeLabel(java.lang.String label)
                          throws Win32Exception
Sets the volume label.

Parameters:
label - the volume label. null to remove the volume label.
Throws:
Win32Exception - if any error occurs.

toString

public final java.lang.String toString()
Returns the drive specifier.

Overrides:
toString in class java.lang.Object
Returns:
the drive specifier.

getVolumeSerialNumber

public final int getVolumeSerialNumber()
                                throws Win32Exception
Returns the volume's serial number.

Returns:
the volume's serial number.
Throws:
Win32Exception - if any error occurs.
Since:
1.1.0 11/18/2001

getMaximumPathComponentLength

public final int getMaximumPathComponentLength()
                                        throws Win32Exception
Returns the maximum path component length.

Returns:
the maximum path component length.
Throws:
Win32Exception - if any error occurs.
Since:
1.1.0 11/18/2001

getFileSystemFlags

public final int getFileSystemFlags()
                             throws Win32Exception
Returns the file FileSystemFlag.

Returns:
the file system's flags.
Throws:
Win32Exception - if any error occurs.
Since:
1.1.0 11/18/2001

getFileSystemName

public final java.lang.String getFileSystemName()
                                         throws Win32Exception
Returns the file system's name.

Returns:
the file system's name.
Throws:
Win32Exception - if any error occurs.
Since:
1.1.0 11/18/2001

Servertec
Foundation Classes
1.3.3 09/04/2005

Copyright © 2001-2005 Servertec. All rights reserved.