Package slash.common.io
Class WindowsShortcut
java.lang.Object
slash.common.io.WindowsShortcut
- All Implemented Interfaces:
ResolvableLink
Represents a Windows shortcut (typically visible to Java only as a '.lnk' file),
the counterpart to a macOS
MacAlias. Parsing is delegated to the mslinks
library; this class keeps the small facade RouteConverter relies on.- Author:
- Christian Pesch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanisFile()static booleanisPotentialValidLink(File file) Provides a quick test to see if this could be a valid link.
-
Constructor Details
-
WindowsShortcut
- Throws:
IOException
-
-
Method Details
-
isPotentialValidLink
Provides a quick test to see if this could be a valid link. Instantiating aWindowsShortcutfor an invalid link throws, and exceptions are slow, so code looping over several files should check this first.- Parameters:
file- the potential link- Returns:
- true if it may be a link, false otherwise
- Throws:
IOException- if an IOException is thrown while reading from the file
-
getRealFilename
- Specified by:
getRealFilenamein interfaceResolvableLink- Returns:
- the name of the filesystem object pointed to by this shortcut
-
isDirectory
public boolean isDirectory()- Specified by:
isDirectoryin interfaceResolvableLink- Returns:
- true if the shortcut points to a directory, false otherwise
-
isFile
public boolean isFile()- Specified by:
isFilein interfaceResolvableLink- Returns:
- true if the link points to a file
-