public class GuiffyUPatch
extends java.lang.Thread
GuiffyUPatch scans the Patch file for the changes made to the Original file. Changes made to other files are skipped over. GuiffyUPatch scans both backward and forward to find the matching context for a change. If GuiffyUPatch cannot find the context for a change, it writes that change (also called a hunk) to a reject file. The reject file is normally the name of the Output file plus a .rej suffix.
End-of-Line differences are ignored when matching context. Properties are provided for specifying End-of-Line and Encoding formats.
Example code :
The following instantiates a GuiffyUPatch object
with all its properties set to default.
import com.guiffy.inside.*;
...
GuiffyUPatch uPatch = new GuiffyUPatch( );
Then, we set GuiffyUPatch's properties (at least the 3 filenames).
uPatch.setOrgFile(orgFileName);
uPatch.setPatFile(patFileName);
uPatch.setOutFile(outFileName);
Then, we run GuiffyUPatch and wait for it to finish.
try {
uPatch.join();
} catch (InterruptedException e) { }
Then, we check the return status and get info on chunks (changes) applied.
int rstat = uPatch.getStatus();
int noChunks = uPatch.getNumberofChunks();
int noAppChunks = uPatch.getNumberofAppliedChunks();
int noNotChunks = uPatch.getNumberofNotAppliedChunks();
...
Thread| Modifier and Type | Field | Description |
|---|---|---|
static int |
CANT_FIND_ORGFILE |
|
static int |
CANT_FIND_PATFILE |
|
static int |
CANT_READ_ORGFILE |
|
static int |
CANT_READ_PATFILE |
|
static int |
CANT_WRIT_OUTFILE |
|
static int |
CONTEXT |
|
static int |
EDIT |
|
static int |
ENCODING_NOTAVAIL |
|
static int |
ERRORIS_EXCEPTION |
|
static int |
EVALPER_ISEXPIRED |
|
static int |
ISAFOLDER_ORGFILE |
|
static int |
ISAFOLDER_PATFILE |
|
static int |
NORMAL |
|
static int |
OK |
|
static int |
PATFILE_NOTUNIFID |
|
static int |
UNIFIED |
|
static int |
UPATCH_FNNOTFOUND |
|
static int |
UPATCH_NOTALLOWED |
|
static int |
UPATCH_NOTCOMPLET |
| Constructor | Description |
|---|---|
GuiffyUPatch() |
| Modifier and Type | Method | Description |
|---|---|---|
int |
getNumberofAppliedChunks() |
Returns the number of applied patch chunks.
|
int |
getNumberofChunks() |
Returns the number of patch chunks.
|
int |
getNumberofNotAppliedChunks() |
Returns the number of Not applied patch chunks.
|
int |
getStatus() |
Returns Status of GuiffyUPatch Run.
|
java.util.List<com.guiffy.inside.UnifiedChunk> |
getUnifiedChunksList() |
Returns the List of Unified Chunks.
|
void |
run() |
|
void |
setEOLOption(java.lang.String eolopt) |
Sets Write EOLs option for Output file.
|
void |
setFileEncoding(java.lang.String encods) |
Sets File Encoding for Original, Patch, and Output files.
|
void |
setGuiffyExit(GuiffyExit hook) |
Sets the GuiffyExit hook of the GuiffyUPatch
If set to null, a previously added GuiffyExit hook will be removed.
|
void |
setIgnoreWhitespace(boolean ignwhi) |
Sets IgnoreWhitespace option true or false.
|
void |
setOEMLicenseKey(java.io.ByteArrayInputStream bais) |
Set License Key based on special OEMKey ByteArrayInputStream
|
void |
setOrgFile(java.lang.String orgname) |
Sets the Original File Name.
|
void |
setOrgFileEncoding(java.lang.String encods) |
Sets File Encoding for Original file.
|
void |
setOutFile(java.lang.String outname) |
Sets the Output File Name.
|
void |
setOutFileEncoding(java.lang.String encods) |
Sets File Encoding for Output file.
|
void |
setPatFile(java.lang.String patname) |
Sets the Patch File Name.
|
void |
setPatFileEncoding(java.lang.String encods) |
Sets File Encoding for Patch file.
|
void |
setRejectsOut(boolean rejout) |
Sets Rejects Output option true or false.
|
void |
setRejFile(java.lang.String rejname) |
Sets the Rejects File Name.
|
void |
setSilentOption(boolean silopt) |
Sets Silent Output option true or false.
|
void |
setVerboseOption(boolean veropt) |
Sets Verbose Output option true or false.
|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitactiveCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldpublic static final int OK
public static final int CANT_FIND_ORGFILE
public static final int CANT_FIND_PATFILE
public static final int CANT_READ_ORGFILE
public static final int CANT_READ_PATFILE
public static final int CANT_WRIT_OUTFILE
public static final int ISAFOLDER_ORGFILE
public static final int ISAFOLDER_PATFILE
public static final int PATFILE_NOTUNIFID
public static final int ENCODING_NOTAVAIL
public static final int ERRORIS_EXCEPTION
public static final int EVALPER_ISEXPIRED
public static final int UPATCH_NOTALLOWED
public static final int UPATCH_NOTCOMPLET
public static final int UPATCH_FNNOTFOUND
public static final int NORMAL
public static final int EDIT
public static final int CONTEXT
public static final int UNIFIED
public void run()
run in class java.lang.Threadpublic int getStatus()
OK = 0;
CANT_FIND_ORGFILE = 1; // Can't find Original file
CANT_FIND_PATFILE = 2; // Can't find Patch file
CANT_READ_ORGFILE = 4; // Can't read Original file
CANT_READ_PATFILE = 5; // Can't read Patch file
CANT_WRIT_OUTFILE = 7; // Can't write/create Output file
ISAFOLDER_ORGFILE = 8; // Original file is a folder
ISAFOLDER_PATFILE = 9; // Patch file is a folder
ENCODING_NOTAVAIL = 11; // File Encoding specified NA
ERRORIS_EXCEPTION = 12; // Exception
// (perhaps, encoding format)
EVALPER_ISEXPIRED = 13; // Evaluation period has expired
UPATCH_NOTALLOWED = 15; // eXpert license required
UPATCH_NOTCOMPLET = 16; // One or more changes(chunks) not applied
UPATCH_FNNOTFOUND = 17; // Patchs for Original file not found in
Patch file
public int getNumberofChunks()
public int getNumberofAppliedChunks()
public int getNumberofNotAppliedChunks()
public java.util.List<com.guiffy.inside.UnifiedChunk> getUnifiedChunksList()
public void setGuiffyExit(GuiffyExit hook)
hook - GuiffyExit hookGuiffyExitpublic void setOEMLicenseKey(java.io.ByteArrayInputStream bais)
bais - the License Key ByteArraryInputStreampublic void setOrgFile(java.lang.String orgname)
orgname - the Original File name as a complete path.public void setPatFile(java.lang.String patname)
patname - the Patch File name as a complete path.public void setOutFile(java.lang.String outname)
outname - the Output File name as a complete path.public void setRejFile(java.lang.String rejname)
rejname - the Rejects File name as a complete path.public void setFileEncoding(java.lang.String encods)
encods - the String value of the Encoding such as "ASCII", "UTF8",
"SJIS", "Cp500" (for EBCDIC) etc. - Over 100 formats supported.public void setOrgFileEncoding(java.lang.String encods)
encods - the String value of the Encoding such as "ASCII", "UTF8",
"SJIS", "Cp500" (for EBCDIC) etc. - Over 100 formats supported.public void setPatFileEncoding(java.lang.String encods)
encods - the String value of the Encoding such as "ASCII", "UTF8",
"SJIS", "Cp500" (for EBCDIC) etc. - Over 100 formats supported.public void setOutFileEncoding(java.lang.String encods)
encods - the String value of the Encoding such as "ASCII", "UTF8",
"SJIS", "Cp500" (for EBCDIC) etc. - Over 100 formats supported.public void setIgnoreWhitespace(boolean ignwhi)
ignwhi - the boolean value that determines whether whitespace
differences are ignored during the patch.public void setRejectsOut(boolean rejout)
rejout - the boolean value that determines whether rejects
are written to Rejects file.public void setSilentOption(boolean silopt)
silopt - the boolean value that suppresses info to stdoutpublic void setVerboseOption(boolean veropt)
veropt - the boolean value that writes addl info to stderrpublic void setEOLOption(java.lang.String eolopt)
eolopt - the String value of "DOS", "MacOS" or "Unix" specifies
the format for writing End-Of-Lines in Output File.