public class HardLink extends Object
限定符和类型 | 类和说明 |
---|---|
static class |
HardLink.LinkStats
HardLink statistics counters and methods.
|
static class |
HardLink.OSType |
限定符和类型 | 字段和说明 |
---|---|
HardLink.LinkStats |
linkStats |
static HardLink.OSType |
osType |
构造器和说明 |
---|
HardLink() |
限定符和类型 | 方法和说明 |
---|---|
static void |
createHardLink(File file,
File linkName)
Creates a hardlink
|
static void |
createHardLinkMult(File parentDir,
String[] fileBaseNames,
File linkDir)
Creates hardlinks from multiple existing files within one parent
directory, into one target directory.
|
protected static int |
createHardLinkMult(File parentDir,
String[] fileBaseNames,
File linkDir,
int maxLength) |
static int |
getLinkCount(File fileName)
Retrieves the number of links to the specified file.
|
protected static int |
getLinkMultArgLength(File fileDir,
String[] fileBaseNames,
File linkDir)
Calculate the nominal length of all contributors to the total
commandstring length, including fixed overhead of the OS-dependent
command.
|
protected static int |
getMaxAllowedCmdArgLength()
Return this private value for use by unit tests.
|
public static HardLink.OSType osType
public final HardLink.LinkStats linkStats
protected static int getLinkMultArgLength(File fileDir, String[] fileBaseNames, File linkDir) throws IOException
fileDir
- - source directory, parent of fileBaseNamesfileBaseNames
- - array of path-less file names, relative
to the source directorylinkDir
- - target directory where the hardlinks will be putIOException
protected static int getMaxAllowedCmdArgLength()
public static void createHardLink(File file, File linkName) throws IOException
file
- - existing source filelinkName
- - desired target link fileIOException
public static void createHardLinkMult(File parentDir, String[] fileBaseNames, File linkDir) throws IOException
parentDir
- - directory containing source filesfileBaseNames
- - list of path-less file names, as returned by
parentDir.list()linkDir
- - where the hardlinks should be put. It must already exist.
If the list of files is too long (overflows maxAllowedCmdArgLength),
we will automatically split it into multiple invocations of the
underlying method.IOException
protected static int createHardLinkMult(File parentDir, String[] fileBaseNames, File linkDir, int maxLength) throws IOException
IOException
public static int getLinkCount(File fileName) throws IOException
IOException
Copyright © 2009 The Apache Software Foundation