Package com.sun.javatest
Class EditLinks
- java.lang.Object
-
- com.sun.javatest.EditLinks
-
public class EditLinks extends java.lang.Object
A utility to rewrite links within a set of HTML files.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EditLinks.BadArgs
An exception to report bad command line arguments.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEdit(java.lang.String oldPrefix, java.lang.String newPrefix)
Add another edit to be applied when the files are edited.void
edit(java.io.File[] src, java.io.File dest)
Edit the given files, using the current set of edits and ignores.void
edit(java.io.File src, java.io.File dest)
Edit the given file, using the current set of edits and ignores.void
ignore(java.lang.String file)
Add another file to be ignored when the files are edited.static void
main(java.lang.String[] args)
Command line entry point.
Usage:void
run()
Edit the files set up by theEditLinks(String[])
constructor.
-
-
-
Constructor Detail
-
EditLinks
public EditLinks()
Create an empty editor object.
-
EditLinks
public EditLinks(java.lang.String[] args) throws EditLinks.BadArgs
Create an editor object based on command line args. It is an error if no edits, no input files, or no output file is given.- Parameters:
args
- Command line args.- Throws:
EditLinks.BadArgs
- if problems are found in the given arguments.- See Also:
main(java.lang.String[])
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
Command line entry point.
Usage:java com.sun.javatest.EditLinks options files...
Arguments:- -e oldPrefix newPrefix
- Links beginning with oldPrefix are rewritten to begin with newPrefix
- -ignore file
- Ignore files and directories named 'file' when scanning directories. E.g. -ignore SCCS
- -o file
- Output file or directory. It should only be a file if the input is a single file; otherwise it should be a directory.
- files...
- Input files or directories to be copied, with the links edited.
- Parameters:
args
- Command line arguments, per the usage as described.
-
addEdit
public void addEdit(java.lang.String oldPrefix, java.lang.String newPrefix)
Add another edit to be applied when the files are edited.- Parameters:
oldPrefix
- The prefix of HTML references to be updated.newPrefix
- The replacement value for occurrences of oldPrefix.
-
ignore
public void ignore(java.lang.String file)
Add another file to be ignored when the files are edited. For example, specify "SCCS" to ignore SCCS directories.- Parameters:
file
- The name of a file to be ignored when editing.
-
run
public void run() throws java.io.IOException
Edit the files set up by theEditLinks(String[])
constructor.- Throws:
java.io.IOException
- if any errors occur while editing the specified files.
-
edit
public void edit(java.io.File[] src, java.io.File dest) throws java.io.IOException
Edit the given files, using the current set of edits and ignores. The source files may be files or directories; the destination can be a directory, or a file if the source is a single file.- Parameters:
src
- An array of files or directories of files to be edited.dest
- A destination file for the edit.- Throws:
java.io.IOException
- if any problems occur while editing the specified files.java.lang.IllegalArgumentException
- if the destination is a single file but the source file is not.- See Also:
edit(File, File)
-
edit
public void edit(java.io.File src, java.io.File dest) throws java.io.IOException
Edit the given file, using the current set of edits and ignores. The source files may be file or directory; the destination can be a directory, or a file if the source is a single file.- Parameters:
src
- A file or directory of files to be edited.dest
- A destination file for the edit.- Throws:
java.io.IOException
- if any problems occur while editing the specified files.java.lang.IllegalArgumentException
- if the destination is a single file but the source file is not.- See Also:
edit(File, File)
-
-