|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jenkinsci.plugins.darcs.DarcsXmlSanitizer
class DarcsXmlSanitizer
Darcs XML Sanitizer. The output of "darcs changes --xml-output" might be invalid XML. Darcs treats the patch comments as binary blobs, and the changes command returns them as-is inside the XML structure, without ensuring that the encoding is consistent. If some of the patches in your repository were recorded on UTF-8 machines and others on e.g. ISO-8859 machines, the XML output will contain characters in both encodings. Some parsers (e.g. xerxes) choke on invalid characters in the XML input, so this sanitizer is designed to ensure that the encoding is consistent.
Nested Class Summary | |
---|---|
private static class |
DarcsXmlSanitizer.State
States which indicates where in the comment string we are. |
Field Summary | |
---|---|
private static List<String> |
ADDL_CHARSETS
|
private List<CharsetDecoder> |
decoders
|
Constructor Summary | |
---|---|
DarcsXmlSanitizer()
Dedicated constructor. |
Method Summary | |
---|---|
String |
cleanse(byte[] input)
Cleanse the mixed encoding in the input byte array. |
String |
cleanse(File file)
|
private static int[] |
computeFailure(byte[] pattern)
Computes the failure function using a bootstrapping process, where the pattern is matched against itself. |
private static int |
positionAfterNext(byte[] data,
int start,
byte[] pattern)
|
private static int |
positionBeforeNext(byte[] data,
int start,
byte[] pattern)
Knuth-Morris-Pratt pattern matching algorithm. |
private byte[] |
readFile(File file)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final List<String> ADDL_CHARSETS
private final List<CharsetDecoder> decoders
Constructor Detail |
---|
public DarcsXmlSanitizer()
Method Detail |
---|
private static int positionBeforeNext(byte[] data, int start, byte[] pattern)
data
- start
- pattern
-
private static int positionAfterNext(byte[] data, int start, byte[] pattern)
data
- start
- pattern
-
private static int[] computeFailure(byte[] pattern)
pattern
-
public String cleanse(byte[] input)
input
-
public String cleanse(File file) throws IOException
file
-
IOException
cleanse(byte[])
private byte[] readFile(File file) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |