|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.starbase.diff.EditListWriter
|
+--com.starbase.diff.HTMLDiffWriter
Writes a simple HTML page showing the differences between two text files.
| Field Summary | |
static int |
DEFAULT_SPACES_PER_TAB
The default number of spaces per tab character (currently 4). |
| Constructor Summary | |
HTMLDiffWriter(java.io.BufferedWriter output,
int tabs,
ParsedCharSequence source,
ParsedCharSequence target)
Deprecated. |
|
HTMLDiffWriter(ParsedCharSequence source,
ParsedCharSequence target,
java.io.BufferedWriter output)
Deprecated. |
|
HTMLDiffWriter(ParsedCharSequence source,
ParsedCharSequence target,
java.io.File output)
Constructs a simple HTMLDiffWriter, writing output to the specified file. |
|
HTMLDiffWriter(ParsedCharSequence source,
ParsedCharSequence target,
java.io.Writer output)
Constructs a simple HTMLDiffWriter, writing output to the specified Writer. |
|
| Method Summary | |
void |
deleteLines(int sourceStart,
int targetStart,
int length)
|
void |
finish()
|
java.lang.String |
getAddedSymbolHTML()
Gets the HTML text used to draw the symbol that indicates an "added" line. |
java.lang.String |
getApplicationFooterHTML()
Gets application-specific HTML text to be drawn at the bottom of the output HTML page. |
java.lang.String |
getApplicationHeaderHTML()
Gets application-specific HTML text to be drawn at the top of the output HTML page. |
java.lang.String |
getCRHTML()
Returns the string representation of the Carriage-return character in the HTML document. |
java.lang.String |
getDeletedSymbolHTML()
Gets the HTML text used to draw the symbol that indicates a "deleted" line. |
boolean |
getEmbedDefaultStyles()
Determines whether or not a default style sheet is embedded in the HTML document. |
java.lang.String |
getGotoBlankHTML()
Gets the HTML text used to draw whitespace the same width as a naviation control. |
java.lang.String |
getGotoBottomHTML()
Gets the HTML text used to draw the navigation symbol that jumps to the bottom of the output page. |
java.lang.String |
getGotoFirstDiffHTML()
Gets the HTML text used to draw the navigation symbol that jumps to the first difference on the output page. |
java.lang.String |
getGotoLastDiffHTML()
Gets the HTML text used to draw the navigation symbol that jumps to the last difference on the output page. |
java.lang.String |
getGotoNextDiffHTML()
Gets the HTML text used to draw the navigation symbol that jumps to the next difference on the output page. |
java.lang.String |
getGotoPrevDiffHTML()
Gets the HTML text used to draw the navigation symbol that jumps to the previous difference on the output page. |
java.lang.String |
getGotoTopHTML()
Gets the HTML text used to draw the navigation symbol that jumps to the top of the output page. |
java.lang.String |
getInlineDeleteMarkHTML()
Gets the HTML text used to mark an in-line deletion point within a source line. |
java.lang.String |
getInlineInsertMarkHTML()
Gets the HTML text used to mark an in-line insertion point within a source line. |
java.lang.String |
getLFHTML()
Returns the string representation of the line-feed character in the HTML document. |
boolean |
getNavigateOnEveryChangedLine()
Indicates whether or not navigation symbols will be drawn on every changed line. |
int |
getNumContextLines()
Gets the maximum number of unchanged lines displayed before and after each changed line. |
java.lang.String |
getPageBaseURL()
Gets the base URL of the output HTML page. |
java.lang.String |
getPageTitle()
Gets the title of the output HTML page. |
java.lang.String |
getReplacedSymbolHTML()
Gets the HTML text used to draw the symbol that indicates a "replaced" line. |
boolean |
getShowEOLs()
Indicates whether or not "replaced" lines show markup within the line. |
boolean |
getShowInlineDiffs()
Indicates whether or not "replaced" lines show markup within the line. |
boolean |
getShowLineNumbers()
Determines whether or not line numbers are embedded in the HTML document. |
boolean |
getShowUnchangedLines()
Determines whether or not unchanged lines are displayed in the HTML document. |
java.lang.String |
getSourceFileHTML()
Gets the HTML text used to display the name of the source file on the output page. |
java.lang.String |
getSourceFileURL()
Gets the URL used to link to the source file from the output HTML page. |
int |
getSpacesPerTab()
Gets the number of spaces per tab character. |
java.lang.String |
getStyleSheetURL()
The URL used to reference a linked style sheet. |
java.lang.String |
getTargetFileHTML()
Gets the HTML text used to display the name of the target file on the output page. |
java.lang.String |
getTargetFileURL()
Gets the URL used to link to the target file from the output HTML page. |
java.lang.String |
getUnchangedSymbolHTML()
Gets the HTML text used to draw the symbol that indicates an "unchanged" line. |
void |
insertLines(int sourceStart,
int targetStart,
int length)
|
void |
replaceLines(int sourcePos,
int sourceLen,
int targetPos,
int targetLen)
Called when lines in the source are replaced by lines in the target. |
void |
setAddedSymbolHTML(java.lang.String strHTML)
Sets the HTML text used to draw the symbol that indicates an "added" line. |
void |
setApplicationFooterHTML(java.lang.String strHTML)
Sets application-specific HTML text to be drawn at the bottom of the output HTML page. |
void |
setApplicationHeaderHTML(java.lang.String strHTML)
Sets application-specific HTML text to be drawn at the top of the output HTML page. |
void |
setCRHTML(java.lang.String strCRHTML)
Sets the representation of the carriage-return character in the HTML document. |
void |
setDeletedSymbolHTML(java.lang.String strHTML)
Sets the HTML text used to draw the symbol that indicates a "deleted" line. |
void |
setEmbedDefaultStyles(boolean bEmbed)
Determines whether or not a default style sheet is embedded in the HTML document. |
void |
setGotoBlankHTML(java.lang.String strHTML)
Sets the HTML text used to draw whitespace the same width as a naviation control. |
void |
setGotoBottomHTML(java.lang.String strHTML)
Sets the HTML text used to draw the navigation symbol that jumps to the bottom of the output page. |
void |
setGotoFirstDiffHTML(java.lang.String strHTML)
Sets the HTML text used to draw the navigation symbol that jumps to the first difference on the output page. |
void |
setGotoLastDiffHTML(java.lang.String strHTML)
Sets the HTML text used to draw the navigation symbol that jumps to the last difference on the output page. |
void |
setGotoNextDiffHTML(java.lang.String strHTML)
Sets the HTML text used to draw the navigation symbol that jumps to the next difference on the output page. |
void |
setGotoPrevDiffHTML(java.lang.String strHTML)
Sets the HTML text used to draw the navigation symbol that jumps to the previous difference on the output page. |
void |
setGotoTopHTML(java.lang.String strHTML)
Sets the HTML text used to draw the navigation symbol that jumps to the top of the output page. |
void |
setInlineDeleteMarkHTML(java.lang.String strHTML)
Sets the HTML text used to mark an in-line deletion point within a source line. |
void |
setInlineInsertMarkHTML(java.lang.String strHTML)
Sets the HTML text used to mark an in-line insertion point within a source line. |
void |
setLFHTML(java.lang.String strLFHTML)
Sets the representation of the line-feed character in the HTML document. |
void |
setNavigateOnEveryChangedLine(boolean bEveryLine)
Determines whether or not navigation symbols will be drawn on every changed line. |
void |
setNumContextLines(int nContextLines)
Sets the maximum number of unchanged lines displayed before and after each changed line. |
void |
setPageBaseURL(java.lang.String strURL)
Sets the base URL of the output HTML page. |
void |
setPageTitle(java.lang.String strTitle)
Sets the title of the output HTML page. |
void |
setReplacedSymbolHTML(java.lang.String strHTML)
Sets the HTML text used to draw the symbol that indicates a "replaced" line. |
void |
setShowEOLs(boolean bShow)
Sets to flag whether or not EOL characters are displayed in the HTML document when compared differently. |
void |
setShowInlineDiffs(boolean bShow)
Determines whether or not "replaced" lines show markup within the line. |
void |
setShowLineNumbers(boolean bShowLineNumbers)
Sets to flag whether or not line numbers are embedded in the HTML document. |
void |
setShowUnchangedLines(boolean bShowUnchangedLines)
Sets to flag whether or not unchanged lines are displayed in the HTML document. |
void |
setSourceFileHTML(java.lang.String strHTML)
Sets the HTML text used to display the name of the source file on the output page. |
void |
setSourceFileURL(java.lang.String strURL)
Sets the URL used to link to the source file from the output HTML page. |
void |
setSpacesPerTab(int nSpaces)
Sets the number of spaces per tab character. |
void |
setStyleSheetURL(java.lang.String strURL)
The URL used to reference a linked style sheet. |
void |
setTargetFileHTML(java.lang.String strHTML)
Sets the HTML text used to display the name of the target file on the output page. |
void |
setTargetFileURL(java.lang.String strURL)
Sets the URL used to link to the target file from the output HTML page. |
void |
setUnchangedSymbolHTML(java.lang.String strHTML)
Sets the HTML text used to draw the symbol that indicates an "unchanged" line. |
static void |
simpleDiff(java.io.File source,
java.io.File target,
java.io.File output)
Compares two text files, and generates a simple HTML file describing the differences. |
void |
start()
Called to tell writer where it can get the source for the lines. |
void |
unchangedLines(int sourceStart,
int targetStart,
int length)
When an original line from the source carries over into the rebuilt output |
| Methods inherited from class com.starbase.diff.EditListWriter |
write |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int DEFAULT_SPACES_PER_TAB
| Constructor Detail |
public HTMLDiffWriter(ParsedCharSequence source,
ParsedCharSequence target,
java.io.File output)
throws java.io.IOException
source - A parsed representation of the source text file.target - A parsed representation of the target text file.output - The output file to generate.ParsedCharSequence
public HTMLDiffWriter(java.io.BufferedWriter output,
int tabs,
ParsedCharSequence source,
ParsedCharSequence target)
output - The output stream.tabs - The number of spaces per tab expanded in the output stream.source - A parsed representation of the source text file.target - A parsed representation of the target text file.ParsedCharSequence
public HTMLDiffWriter(ParsedCharSequence source,
ParsedCharSequence target,
java.io.BufferedWriter output)
source - A parsed representation of the source text file.target - A parsed representation of the target text file.output - The output stream.ParsedCharSequence
public HTMLDiffWriter(ParsedCharSequence source,
ParsedCharSequence target,
java.io.Writer output)
source - A parsed representation of the source text file.target - A parsed representation of the target text file.output - The output stream.ParsedCharSequence| Method Detail |
public void setPageTitle(java.lang.String strTitle)
strTitle - The title of the output HTML page.public java.lang.String getPageTitle()
public void setPageBaseURL(java.lang.String strURL)
The base URL used to resolve links and references to external sources such as images and style sheets.
By default, no explicit base URL is specified, meaning that external references are resolved realtive to the output page.
strURL - The base URL of the output HTML page.public java.lang.String getPageBaseURL()
public void setSourceFileHTML(java.lang.String strHTML)
strHTML - The HTML text used to display
the name of the source file on the output page.public java.lang.String getSourceFileHTML()
HTMLDiffWriter.getTargetFileHTML()public void setTargetFileHTML(java.lang.String strHTML)
strHTML - The HTML text used to display
the name of the target file on the output page.public java.lang.String getTargetFileHTML()
HTMLDiffWriter.getTargetFileHTML()public void setSourceFileURL(java.lang.String strURL)
strURL - The URL used to link to the source file
from the output HTML page, or null if no links to the
source file should be created.public java.lang.String getSourceFileURL()
HTMLDiffWriter.getTargetFileURL(),
HTMLDiffWriter.getPageBaseURL()public void setTargetFileURL(java.lang.String strURL)
strURL - The URL used to link to the target file
from the output HTML page, or null if no links to the
target file should be created.public java.lang.String getTargetFileURL()
HTMLDiffWriter.getSourceFileURL(),
HTMLDiffWriter.getPageBaseURL()public void setApplicationHeaderHTML(java.lang.String strHTML)
strHTML - Application-specific HTML text to be drawn at
the top of the output HTML page.public java.lang.String getApplicationHeaderHTML()
HTMLDiffWriter.getApplicationFooterHTML()public void setApplicationFooterHTML(java.lang.String strHTML)
strHTML - Application-specific HTML text to be drawn at
the bottom of the output HTML page.public java.lang.String getApplicationFooterHTML()
HTMLDiffWriter.getApplicationHeaderHTML()public void setEmbedDefaultStyles(boolean bEmbed)
bEmbed - true (the default) to embed a default
style sheet in the HTML output; false to insert a
link to an external style sheet file.public boolean getEmbedDefaultStyles()
HTMLDiffWriter.getStyleSheetURL()public void setStyleSheetURL(java.lang.String strURL)
strURL - The URL used to reference a linked
style sheet.public java.lang.String getStyleSheetURL()
HTMLDiffWriter.getEmbedDefaultStyles(),
HTMLDiffWriter.getPageBaseURL()public void setShowInlineDiffs(boolean bShow)
bShow - true (the default) if "replaced" lines show markup
within the line; false if each replaced line is
shown as an inserted line followed by a deleted line.public boolean getShowInlineDiffs()
public void setSpacesPerTab(int nSpaces)
nSpaces - The number of space characters represented
by a single tab character, or zero if tabs are not expanded
to spaces in the HTML output.public int getSpacesPerTab()
HTMLDiffWriter.DEFAULT_SPACES_PER_TABpublic void setGotoTopHTML(java.lang.String strHTML)
strHTML - The HTML text used to draw the navigation
symbol that jumps to the top of the output page.public java.lang.String getGotoTopHTML()
HTMLDiffWriter.getGotoBottomHTML(),
HTMLDiffWriter.getGotoFirstDiffHTML(),
HTMLDiffWriter.getGotoLastDiffHTML(),
HTMLDiffWriter.getGotoPrevDiffHTML(),
HTMLDiffWriter.getGotoNextDiffHTML(),
HTMLDiffWriter.getGotoBlankHTML(),
HTMLDiffWriter.getPageBaseURL(),
HTMLDiffWriter.getNavigateOnEveryChangedLine()public void setGotoBottomHTML(java.lang.String strHTML)
strHTML - The HTML text used to draw the navigation
symbol that jumps to the bottom of the output page.public java.lang.String getGotoBottomHTML()
HTMLDiffWriter.getGotoTopHTML(),
HTMLDiffWriter.getGotoFirstDiffHTML(),
HTMLDiffWriter.getGotoLastDiffHTML(),
HTMLDiffWriter.getGotoPrevDiffHTML(),
HTMLDiffWriter.getGotoNextDiffHTML(),
HTMLDiffWriter.getGotoBlankHTML(),
HTMLDiffWriter.getPageBaseURL(),
HTMLDiffWriter.getNavigateOnEveryChangedLine()public void setGotoFirstDiffHTML(java.lang.String strHTML)
strHTML - The HTML text used to draw the navigation symbol
that jumps to the first difference on the output page.public java.lang.String getGotoFirstDiffHTML()
HTMLDiffWriter.getGotoTopHTML(),
HTMLDiffWriter.getGotoBottomHTML(),
HTMLDiffWriter.getGotoLastDiffHTML(),
HTMLDiffWriter.getGotoPrevDiffHTML(),
HTMLDiffWriter.getGotoNextDiffHTML(),
HTMLDiffWriter.getGotoBlankHTML(),
HTMLDiffWriter.getPageBaseURL(),
HTMLDiffWriter.getNavigateOnEveryChangedLine()public void setGotoLastDiffHTML(java.lang.String strHTML)
strHTML - The HTML text used to draw the navigation symbol
that jumps to the last difference on the output page.public java.lang.String getGotoLastDiffHTML()
HTMLDiffWriter.getGotoTopHTML(),
HTMLDiffWriter.getGotoBottomHTML(),
HTMLDiffWriter.getGotoFirstDiffHTML(),
HTMLDiffWriter.getGotoPrevDiffHTML(),
HTMLDiffWriter.getGotoNextDiffHTML(),
HTMLDiffWriter.getGotoBlankHTML(),
HTMLDiffWriter.getPageBaseURL(),
HTMLDiffWriter.getNavigateOnEveryChangedLine()public void setGotoPrevDiffHTML(java.lang.String strHTML)
strHTML - The HTML text used to draw the navigation symbol
that jumps to the previous difference on the output page.public java.lang.String getGotoPrevDiffHTML()
HTMLDiffWriter.getGotoTopHTML(),
HTMLDiffWriter.getGotoBottomHTML(),
HTMLDiffWriter.getGotoFirstDiffHTML(),
HTMLDiffWriter.getGotoLastDiffHTML(),
HTMLDiffWriter.getGotoNextDiffHTML(),
HTMLDiffWriter.getGotoBlankHTML(),
HTMLDiffWriter.getPageBaseURL(),
HTMLDiffWriter.getNavigateOnEveryChangedLine()public void setGotoNextDiffHTML(java.lang.String strHTML)
strHTML - The HTML text used to draw the navigation symbol
that jumps to the next difference on the output page.public java.lang.String getGotoNextDiffHTML()
HTMLDiffWriter.getGotoTopHTML(),
HTMLDiffWriter.getGotoBottomHTML(),
HTMLDiffWriter.getGotoFirstDiffHTML(),
HTMLDiffWriter.getGotoLastDiffHTML(),
HTMLDiffWriter.getGotoPrevDiffHTML(),
HTMLDiffWriter.getGotoBlankHTML(),
HTMLDiffWriter.getPageBaseURL(),
HTMLDiffWriter.getNavigateOnEveryChangedLine()public void setGotoBlankHTML(java.lang.String strHTML)
strHTML - The HTML text used to draw whitespace the same width
as a naviation control.public java.lang.String getGotoBlankHTML()
HTMLDiffWriter.getGotoTopHTML(),
HTMLDiffWriter.getGotoBottomHTML(),
HTMLDiffWriter.getGotoFirstDiffHTML(),
HTMLDiffWriter.getGotoLastDiffHTML(),
HTMLDiffWriter.getGotoPrevDiffHTML(),
HTMLDiffWriter.getGotoNextDiffHTML(),
HTMLDiffWriter.getPageBaseURL(),
HTMLDiffWriter.getNavigateOnEveryChangedLine()public void setNavigateOnEveryChangedLine(boolean bEveryLine)
bEveryLine - true to draw navigation symbols on
every changed line; false (the default) to draw navigation
symbols only on the first line of multi-line changes.public boolean getNavigateOnEveryChangedLine()
HTMLDiffWriter.getGotoTopHTML(),
HTMLDiffWriter.getGotoBottomHTML(),
HTMLDiffWriter.getGotoFirstDiffHTML(),
HTMLDiffWriter.getGotoLastDiffHTML(),
HTMLDiffWriter.getGotoPrevDiffHTML(),
HTMLDiffWriter.getGotoNextDiffHTML(),
HTMLDiffWriter.getGotoBlankHTML()public void setShowLineNumbers(boolean bShowLineNumbers)
bShowLineNumbers - The desired value of the flag to
show line numbers in HTML output.public boolean getShowLineNumbers()
public void setShowUnchangedLines(boolean bShowUnchangedLines)
public boolean getShowUnchangedLines()
public void setNumContextLines(int nContextLines)
nContextLines - The maximum number of unchanged
lines displayed before and after each changed line.public int getNumContextLines()
HTMLDiffWriter.getShowUnchangedLines()public void setShowEOLs(boolean bShow)
bShow - true if EOL characters are displayed in HTML
document when compared differently; false (the default)
they are not displayed at all.public boolean getShowEOLs()
HTMLDiffWriter.getCRHTML(),
HTMLDiffWriter.getLFHTML()public void setCRHTML(java.lang.String strCRHTML)
strCRHTML - The string representation of the carriage-return
character in the HTML document.public java.lang.String getCRHTML()
HTMLDiffWriter.getLFHTML(),
HTMLDiffWriter.getShowEOLs()public void setLFHTML(java.lang.String strLFHTML)
strLFHTML - The string representation of the line-feed
character in the HTML document.public java.lang.String getLFHTML()
HTMLDiffWriter.getCRHTML(),
HTMLDiffWriter.getShowEOLs()public void setAddedSymbolHTML(java.lang.String strHTML)
strHTML - The HTML text used to draw the symbol that
indicates an "added" line.public java.lang.String getAddedSymbolHTML()
HTMLDiffWriter.getDeletedSymbolHTML(),
HTMLDiffWriter.getReplacedSymbolHTML(),
HTMLDiffWriter.getUnchangedSymbolHTML(),
HTMLDiffWriter.getPageBaseURL()public void setDeletedSymbolHTML(java.lang.String strHTML)
strHTML - The HTML text used to draw the symbol that
indicates a "deleted" line.public java.lang.String getDeletedSymbolHTML()
HTMLDiffWriter.getAddedSymbolHTML(),
HTMLDiffWriter.getReplacedSymbolHTML(),
HTMLDiffWriter.getUnchangedSymbolHTML(),
HTMLDiffWriter.getPageBaseURL()public void setReplacedSymbolHTML(java.lang.String strHTML)
strHTML - The HTML text used to draw the symbol that
indicates a "replaced" line.public java.lang.String getReplacedSymbolHTML()
HTMLDiffWriter.getAddedSymbolHTML(),
HTMLDiffWriter.getDeletedSymbolHTML(),
HTMLDiffWriter.getUnchangedSymbolHTML(),
HTMLDiffWriter.getPageBaseURL()public void setUnchangedSymbolHTML(java.lang.String strHTML)
strHTML - The HTML text used to draw the symbol that
indicates an "unchanged" line.public java.lang.String getUnchangedSymbolHTML()
HTMLDiffWriter.getAddedSymbolHTML(),
HTMLDiffWriter.getDeletedSymbolHTML(),
HTMLDiffWriter.getReplacedSymbolHTML(),
HTMLDiffWriter.getPageBaseURL()public void setInlineInsertMarkHTML(java.lang.String strHTML)
strHTML - The HTML text used to mark an in-line
insertion point within a source line.public java.lang.String getInlineInsertMarkHTML()
HTMLDiffWriter.getInlineDeleteMarkHTML(),
HTMLDiffWriter.getPageBaseURL()public void setInlineDeleteMarkHTML(java.lang.String strHTML)
strHTML - The HTML text used to mark an in-line
deletion point within a source line.public java.lang.String getInlineDeleteMarkHTML()
HTMLDiffWriter.getInlineInsertMarkHTML(),
HTMLDiffWriter.getPageBaseURL()
public static void simpleDiff(java.io.File source,
java.io.File target,
java.io.File output)
throws java.io.FileNotFoundException,
java.io.IOException,
DiffException
Uses a default text comparison algorithm: leading and trailing whitespace is ignored, and sequential whitespace characters within a line are treated as equivalent to a single space character.
source - The source text file.target - The target text file.output - The output file to generate.
java.io.FileNotFoundException
java.io.IOException
DiffException
public void start()
throws java.io.IOException
EditListWriter
start in class EditListWriterjava.io.IOException
public void finish()
throws java.io.IOException
finish in class EditListWriterjava.io.IOException
public void unchangedLines(int sourceStart,
int targetStart,
int length)
throws java.io.IOException
EditListWriter
unchangedLines in class EditListWriterjava.io.IOException
public void insertLines(int sourceStart,
int targetStart,
int length)
throws java.io.IOException
insertLines in class EditListWriterjava.io.IOException
public void deleteLines(int sourceStart,
int targetStart,
int length)
throws java.io.IOException
deleteLines in class EditListWriterjava.io.IOException
public void replaceLines(int sourcePos,
int sourceLen,
int targetPos,
int targetLen)
throws java.io.IOException
EditListWriter
replaceLines in class EditListWriterjava.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||