|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nothome.delta.text.GDiffTextWriter
public class GDiffTextWriter
A text-file format analog for GDIFF, which is only supported for binary streams. The output follows the following extended BNF format:
gdiff-text ::= header , { copy | data } header ::= 'gdt' , { version } , '\n' copy ::= 'y' offset ',' length '\n' data ::= 'i' length '\n' text-chunk '\n' length ::= hex-digit , { hex-digit } offset ::= hex-digit , { hex-digit } hex-digit ::= '0'-'9' | 'a'-'f' text-chunk ::= (* arbitrary text string *) version ::= '1'-'9'Note that 'y' is used for copy and 'i' for data since they aren't to be confused with the hex characters 'c' and 'd'.
Note that the length of text-string is capped at CHUNK_SIZE
characters
for this implementation.
The initial version is 1 and is optionally indicated. Newer versions may support additional commands and hints.
See also: http://www.w3.org/TR/NOTE-gdiff-19970901.html.
Field Summary | |
---|---|
static int |
CHUNK_SIZE
Max length of a "text-chunk". |
static char |
COMMA
Comma delimiter. |
static char |
COPY
Copy command character. |
static char |
DATA
Data command character. |
static char |
LF
Line feed character. |
Constructor Summary | |
---|---|
GDiffTextWriter(Writer w)
Constructs a new GDiffTextWriter. |
Method Summary | |
---|---|
void |
addCopy(int offset,
int length)
Add a copy command. |
void |
addData(char c)
Add a character to output. |
void |
close()
Frees internal resources; closes output stream. |
void |
flush()
Writes current state to output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char LF
public static final char COPY
public static final char DATA
public static final char COMMA
public static final int CHUNK_SIZE
Constructor Detail |
---|
public GDiffTextWriter(Writer w) throws IOException
w
-
IOException
Method Detail |
---|
public void addCopy(int offset, int length) throws IOException
DiffTextWriter
addCopy
in interface DiffTextWriter
offset
- start of sequencelength
- length of sequence
IOException
public void addData(char c) throws IOException
DiffTextWriter
addData
in interface DiffTextWriter
IOException
public void flush() throws IOException
DiffTextWriter
flush
in interface DiffTextWriter
IOException
public void close() throws IOException
DiffTextWriter
close
in interface DiffTextWriter
close
in interface Closeable
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |