Package com.twelvemonkeys.io
Class Win32Lnk
- java.lang.Object
-
- java.io.File
-
- com.twelvemonkeys.io.Win32Lnk
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<java.io.File>
final class Win32Lnk extends java.io.File
AFile
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
Fields Modifier and Type Field Description private static int
FLAG_ADDITIONAL_INFO
private static int
FLAG_COMMAND_LINE_ARGS
private static int
FLAG_DESC_STRING
private static int
FLAG_FILE_LOC_INFO
private static int
FLAG_ICON_FILENAME
private static int
FLAG_ITEM_ID_LIST
private static int
FLAG_REL_PATH_STRING
private static int
FLAG_WORKING_DIRECTORY
private static byte[]
LNK_GUID
private static byte[]
LNK_MAGIC
private java.io.File
target
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canRead()
boolean
canWrite()
boolean
exists()
java.io.File
getCanonicalFile()
java.lang.String
getCanonicalPath()
java.io.File
getTarget()
Converts two bytes into a short.boolean
isDirectory()
boolean
isFile()
boolean
isHidden()
long
lastModified()
long
length()
java.lang.String[]
list()
java.lang.String[]
list(java.io.FilenameFilter filter)
java.io.File[]
listFiles()
java.io.File[]
listFiles(java.io.FileFilter filter)
java.io.File[]
listFiles(java.io.FilenameFilter filter)
(package private) static java.io.File
parse(java.io.File pPath)
Parses a.lnk
file to find the real file.boolean
setLastModified(long time)
boolean
setReadOnly()
java.lang.String
toString()
-
Methods inherited from class java.io.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 Detail
-
LNK_MAGIC
private static final byte[] LNK_MAGIC
-
LNK_GUID
private static final byte[] LNK_GUID
-
target
private final java.io.File target
-
FLAG_ITEM_ID_LIST
private static final int FLAG_ITEM_ID_LIST
- See Also:
- Constant Field Values
-
FLAG_FILE_LOC_INFO
private static final int FLAG_FILE_LOC_INFO
- See Also:
- Constant Field Values
-
FLAG_DESC_STRING
private static final int FLAG_DESC_STRING
- See Also:
- Constant Field Values
-
FLAG_REL_PATH_STRING
private static final int FLAG_REL_PATH_STRING
- See Also:
- Constant Field Values
-
FLAG_WORKING_DIRECTORY
private static final int FLAG_WORKING_DIRECTORY
- See Also:
- Constant Field Values
-
FLAG_COMMAND_LINE_ARGS
private static final int FLAG_COMMAND_LINE_ARGS
- See Also:
- Constant Field Values
-
FLAG_ICON_FILENAME
private static final int FLAG_ICON_FILENAME
- See Also:
- Constant Field Values
-
FLAG_ADDITIONAL_INFO
private static final int FLAG_ADDITIONAL_INFO
- See Also:
- Constant Field Values
-
-
Method Detail
-
parse
static java.io.File parse(java.io.File pPath) throws java.io.IOException
Parses a.lnk
file to find the real file.- Parameters:
pPath
- the path to the.lnk
file- Returns:
- a new file object that
- Throws:
java.io.IOException
- if the.lnk
cannot be parsed
-
getTarget
public java.io.File 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:
isDirectory
in classjava.io.File
-
canRead
public boolean canRead()
- Overrides:
canRead
in classjava.io.File
-
canWrite
public boolean canWrite()
- Overrides:
canWrite
in classjava.io.File
-
exists
public boolean exists()
- Overrides:
exists
in classjava.io.File
-
getCanonicalFile
public java.io.File getCanonicalFile() throws java.io.IOException
- Overrides:
getCanonicalFile
in classjava.io.File
- Throws:
java.io.IOException
-
getCanonicalPath
public java.lang.String getCanonicalPath() throws java.io.IOException
- Overrides:
getCanonicalPath
in classjava.io.File
- Throws:
java.io.IOException
-
isFile
public boolean isFile()
- Overrides:
isFile
in classjava.io.File
-
isHidden
public boolean isHidden()
- Overrides:
isHidden
in classjava.io.File
-
lastModified
public long lastModified()
- Overrides:
lastModified
in classjava.io.File
-
length
public long length()
- Overrides:
length
in classjava.io.File
-
list
public java.lang.String[] list()
- Overrides:
list
in classjava.io.File
-
list
public java.lang.String[] list(java.io.FilenameFilter filter)
- Overrides:
list
in classjava.io.File
-
listFiles
public java.io.File[] listFiles()
- Overrides:
listFiles
in classjava.io.File
-
listFiles
public java.io.File[] listFiles(java.io.FileFilter filter)
- Overrides:
listFiles
in classjava.io.File
-
listFiles
public java.io.File[] listFiles(java.io.FilenameFilter filter)
- Overrides:
listFiles
in classjava.io.File
-
setLastModified
public boolean setLastModified(long time)
- Overrides:
setLastModified
in classjava.io.File
-
setReadOnly
public boolean setReadOnly()
- Overrides:
setReadOnly
in classjava.io.File
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.io.File
-
-