Class Win32Lnk
java.lang.Object
java.io.File
com.twelvemonkeys.io.Win32Lnk
- All Implemented Interfaces:
Serializable, Comparable<File>
A
File implementation that resolves the Windows .lnk files as symbolic links.
This class is based on example code from Swing Hacks, By Joshua Marinacci, Chris Adamson (O'Reilly, ISBN: 0-596-00907-0), Hack 30.
- Version:
- $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/Win32Lnk.java#2 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final byte[]private static final byte[]private final FileFields inherited from class File
pathSeparator, pathSeparatorChar, separator, separatorChar -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRead()booleancanWrite()booleanexists()Converts two bytes into a short.booleanbooleanisFile()booleanisHidden()longlonglength()String[]list()String[]list(FilenameFilter filter) File[]File[]listFiles(FileFilter filter) File[]listFiles(FilenameFilter filter) (package private) static FileParses a.lnkfile to find the real file.booleansetLastModified(long time) booleantoString()Methods inherited from class File
canExecute, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, getAbsoluteFile, getAbsolutePath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setReadable, setReadable, setWritable, setWritable, toPath, toURI, toURL
-
Field Details
-
LNK_MAGIC
private static final byte[] LNK_MAGIC -
LNK_GUID
private static final byte[] LNK_GUID -
target
-
FLAG_ITEM_ID_LIST
private static final int FLAG_ITEM_ID_LIST- See Also:
-
FLAG_FILE_LOC_INFO
private static final int FLAG_FILE_LOC_INFO- See Also:
-
FLAG_DESC_STRING
private static final int FLAG_DESC_STRING- See Also:
-
FLAG_REL_PATH_STRING
private static final int FLAG_REL_PATH_STRING- See Also:
-
FLAG_WORKING_DIRECTORY
private static final int FLAG_WORKING_DIRECTORY- See Also:
-
FLAG_COMMAND_LINE_ARGS
private static final int FLAG_COMMAND_LINE_ARGS- See Also:
-
FLAG_ICON_FILENAME
private static final int FLAG_ICON_FILENAME- See Also:
-
FLAG_ADDITIONAL_INFO
private static final int FLAG_ADDITIONAL_INFO- See Also:
-
-
Constructor Details
-
Win32Lnk
- Throws:
IOException
-
Win32Lnk
Win32Lnk(File pPath) throws IOException - Throws:
IOException
-
-
Method Details
-
parse
Parses a.lnkfile to find the real file.- Parameters:
pPath- the path to the.lnkfile- Returns:
- a new file object that
- Throws:
IOException- if the.lnkcannot be parsed
-
getTarget
Converts two bytes into a short.NOTE: this is little endian because it's for an Intel only OS
- Returns:
- the bytes as a short.
-
isDirectory
public boolean isDirectory()- Overrides:
isDirectoryin classFile
-
canRead
-
canWrite
-
exists
-
getCanonicalFile
- Overrides:
getCanonicalFilein classFile- Throws:
IOException
-
getCanonicalPath
- Overrides:
getCanonicalPathin classFile- Throws:
IOException
-
isFile
-
isHidden
-
lastModified
public long lastModified()- Overrides:
lastModifiedin classFile
-
length
-
list
-
list
-
listFiles
-
listFiles
-
listFiles
-
setLastModified
public boolean setLastModified(long time) - Overrides:
setLastModifiedin classFile
-
setReadOnly
public boolean setReadOnly()- Overrides:
setReadOnlyin classFile
-
toString
-