Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

pspdash
Class NetworkDriveList  view NetworkDriveList download NetworkDriveList.java

java.lang.Object
  extended bypspdash.NetworkDriveList

public class NetworkDriveList
extends java.lang.Object

On Windows systems, this class compiles a list of drive letters that are mapped to network drives, along with the UNC names they are mapped to. It can then be used to translate filenames back and forth between drive letter syntax and UNC syntax.


Field Summary
private  java.util.Map networkDrives
           
private  java.lang.Process subprocess
           
private  boolean successful
           
 
Constructor Summary
NetworkDriveList()
          Get a list of network drives.
NetworkDriveList(int maxDelay)
          Get a list of network drives.
 
Method Summary
 java.lang.String fromUNCName(java.lang.String uncName)
          Convert the given filename (in UNC format) to a drive letter format name.
private  java.lang.String getDriveLetter(java.lang.String filename)
          Extract the drive letter from a filename
private  void getList()
           
 java.lang.String getUNCName(java.lang.String driveLetter)
          Get the UNC name associated with a particular drive letter.
 boolean isNetworkDrive(java.lang.String driveLetter)
          Returns true if the given drive letter names a network drive.
private  boolean isWindows()
          Return true if the operating system is a variant of Windows
 boolean onNetworkDrive(java.lang.String filename)
          Returns true if the given file is on a network drive.
 java.lang.String toUNCName(java.lang.String filename)
          Convert the given filename (in drive letter format) to an UNC name.
 boolean wasSuccessful()
          Return true if this object was able to successfully compile a list of network drives.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

successful

private volatile boolean successful

networkDrives

private java.util.Map networkDrives

subprocess

private volatile java.lang.Process subprocess
Constructor Detail

NetworkDriveList

public NetworkDriveList()
Get a list of network drives. Uses a default maximum delay of 2 seconds.


NetworkDriveList

public NetworkDriveList(int maxDelay)
Get a list of network drives.

Method Detail

getList

private void getList()

wasSuccessful

public boolean wasSuccessful()
Return true if this object was able to successfully compile a list of network drives. On Windows systems, this will return false if the operation took too long and was abandoned. On non-Windows systems, this will always return false.


isNetworkDrive

public boolean isNetworkDrive(java.lang.String driveLetter)
Returns true if the given drive letter names a network drive. If wasSuccessful() returns false, this will always return false.


onNetworkDrive

public boolean onNetworkDrive(java.lang.String filename)
Returns true if the given file is on a network drive. If wasSuccessful() returns false, this will always return false.


getUNCName

public java.lang.String getUNCName(java.lang.String driveLetter)
Get the UNC name associated with a particular drive letter. If isNetworkDrive() returns false for this drive letter, returns null.


toUNCName

public java.lang.String toUNCName(java.lang.String filename)
Convert the given filename (in drive letter format) to an UNC name.


fromUNCName

public java.lang.String fromUNCName(java.lang.String uncName)
Convert the given filename (in UNC format) to a drive letter format name.


isWindows

private boolean isWindows()
Return true if the operating system is a variant of Windows


getDriveLetter

private java.lang.String getDriveLetter(java.lang.String filename)
Extract the drive letter from a filename