Package help
Class HelpBuildUtils
- java.lang.Object
-
- help.HelpBuildUtils
-
public class HelpBuildUtils extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HelpBuildUtils.HelpFilesFilter
static interface
HelpBuildUtils.Stringizer<T>
-
Field Summary
Fields Modifier and Type Field Description static boolean
debug
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
cleanupHelpFileLinks(java.nio.file.Path helpFile)
static java.nio.file.Path
createReferencePath(java.net.URI fileURI)
static void
debug(java.lang.String text)
static java.nio.file.Path
getFile(java.nio.file.Path srcFile, java.lang.String relativePath)
static java.nio.file.Path
getHelpTopicDir(java.nio.file.Path file)
Returns a file object that is the help topic directory for the given file.static java.nio.file.Path
getRoot(java.util.Collection<java.nio.file.Path> roots, java.nio.file.Path file)
static boolean
isRemote(java.lang.String uriString)
Returns true if the given String represents a remote resourcestatic boolean
isRemote(java.net.URI uri)
Returns true if the given URI represents a remote resourcestatic boolean
isRemote(java.nio.file.Path path)
Returns true if the given Path represents a remote resourcestatic ImageLocation
locateImageReference(java.nio.file.Path sourceFile, java.lang.String ref)
Turn an HTML IMG reference into a location object that has resolved path info.static java.nio.file.Path
locateReference(java.nio.file.Path sourceFile, java.lang.String ref)
Turn an HTML HREF reference into an absolute path.static java.nio.file.Path
relativize(java.nio.file.Path parent, java.nio.file.Path child)
static java.nio.file.Path
relativizeWithHelpTopics(java.nio.file.Path p)
static java.nio.file.Path
toDefaultFS(java.nio.file.Path path)
static java.nio.file.Path
toFS(java.nio.file.Path targetFS, java.nio.file.Path path)
static HelpModuleLocation
toLocation(java.io.File file)
-
-
-
Method Detail
-
toLocation
public static HelpModuleLocation toLocation(java.io.File file)
-
getRoot
public static java.nio.file.Path getRoot(java.util.Collection<java.nio.file.Path> roots, java.nio.file.Path file)
-
getHelpTopicDir
public static java.nio.file.Path getHelpTopicDir(java.nio.file.Path file)
Returns a file object that is the help topic directory for the given file. This method is useful for finding the help topic directory when the given file doesn't live directly under a help topic.
-
getFile
public static java.nio.file.Path getFile(java.nio.file.Path srcFile, java.lang.String relativePath)
-
relativizeWithHelpTopics
public static java.nio.file.Path relativizeWithHelpTopics(java.nio.file.Path p)
-
relativize
public static java.nio.file.Path relativize(java.nio.file.Path parent, java.nio.file.Path child)
-
cleanupHelpFileLinks
public static void cleanupHelpFileLinks(java.nio.file.Path helpFile) throws java.io.IOException
- Throws:
java.io.IOException
-
debug
public static void debug(java.lang.String text)
-
toDefaultFS
public static java.nio.file.Path toDefaultFS(java.nio.file.Path path)
-
toFS
public static java.nio.file.Path toFS(java.nio.file.Path targetFS, java.nio.file.Path path)
-
createReferencePath
public static java.nio.file.Path createReferencePath(java.net.URI fileURI)
-
isRemote
public static boolean isRemote(java.lang.String uriString)
Returns true if the given String represents a remote resource- Parameters:
uriString
- the URI to test- Returns:
- true if the given String represents a remote resource
-
isRemote
public static boolean isRemote(java.nio.file.Path path)
Returns true if the given Path represents a remote resource- Parameters:
path
- the path- Returns:
- true if the given Path represents a remote resource
-
isRemote
public static boolean isRemote(java.net.URI uri)
Returns true if the given URI represents a remote resource- Parameters:
uri
- the URI- Returns:
- true if the given URI represents a remote resource
-
locateImageReference
public static ImageLocation locateImageReference(java.nio.file.Path sourceFile, java.lang.String ref) throws java.net.URISyntaxException
Turn an HTML IMG reference into a location object that has resolved path info. This will locate files based upon relative references, specialized help system references (i.e., help/topics/...), and absolute URLs.- Parameters:
sourceFile
- the source file path of the image referenceref
- the reference text- Returns:
- an absolute path; null if the URI is remote
- Throws:
java.net.URISyntaxException
-
locateReference
public static java.nio.file.Path locateReference(java.nio.file.Path sourceFile, java.lang.String ref) throws java.net.URISyntaxException
Turn an HTML HREF reference into an absolute path. This will locate files based upon relative references, specialized help system references (i.e., help/topics/...), and absolute URLs.- Parameters:
ref
- the reference text- Returns:
- an absolute path; null if the URI is remote
- Throws:
java.net.URISyntaxException
-
-