Class EditLinks

java.lang.Object
com.sun.javatest.EditLinks

public class EditLinks extends Object
A utility to rewrite links within a set of HTML files.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    An exception to report bad command line arguments.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an empty editor object.
    EditLinks(String... args)
    Create an editor object based on command line args.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addEdit(String oldPrefix, String newPrefix)
    Add another edit to be applied when the files are edited.
    void
    edit(File[] src, File dest)
    Edit the given files, using the current set of edits and ignores.
    void
    edit(File src, File dest)
    Edit the given file, using the current set of edits and ignores.
    void
    ignore(String file)
    Add another file to be ignored when the files are edited.
    static void
    main(String... args)
    Command line entry point.
    Usage:
    void
    run()
    Edit the files set up by the EditLinks(String[]) constructor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EditLinks

      public EditLinks()
      Create an empty editor object.
    • EditLinks

      public EditLinks(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:
  • Method Details

    • main

      public static void main(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(String oldPrefix, 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(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 IOException
      Edit the files set up by the EditLinks(String[]) constructor.
      Throws:
      IOException - if any errors occur while editing the specified files.
    • edit

      public void edit(File[] src, File dest) throws 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:
      IOException - if any problems occur while editing the specified files.
      IllegalArgumentException - if the destination is a single file but the source file is not.
      See Also:
    • edit

      public void edit(File src, File dest) throws 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:
      IOException - if any problems occur while editing the specified files.
      IllegalArgumentException - if the destination is a single file but the source file is not.
      See Also: