public class HardLink extends Object
Modifier and Type | Class and Description |
---|---|
static class |
HardLink.LinkStats
HardLink statistics counters and methods.
|
Modifier and Type | Field and Description |
---|---|
HardLink.LinkStats |
linkStats |
Constructor and Description |
---|
HardLink() |
Modifier and Type | Method and Description |
---|---|
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 final HardLink.LinkStats linkStats
public HardLink()
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 © 2014 Apache Software Foundation. All Rights Reserved.