public class GDiffWriter extends java.lang.Object implements DiffWriter
Modifier and Type | Field and Description |
---|---|
private java.io.ByteArrayOutputStream |
buf |
static int |
CHUNK_SIZE
Max length of a chunk.
|
static int |
COPY_INT_INT |
static int |
COPY_INT_UBYTE |
static int |
COPY_INT_USHORT |
static int |
COPY_LONG_INT |
static int |
COPY_USHORT_INT |
static int |
COPY_USHORT_UBYTE |
static int |
COPY_USHORT_USHORT |
static int |
DATA_INT |
static int |
DATA_MAX
Max length for single length data encode.
|
static int |
DATA_USHORT |
private boolean |
debug |
static byte |
EOF |
private java.io.DataOutputStream |
output |
Constructor and Description |
---|
GDiffWriter(java.io.DataOutputStream os)
Constructs a new GDiffWriter.
|
GDiffWriter(java.io.OutputStream output)
Constructs a new GDiffWriter.
|
Modifier and Type | Method and Description |
---|---|
void |
addCopy(long offset,
int length)
Add a GDIFF copy instruction.
|
void |
addData(byte b)
Adds a data byte.
|
void |
close()
Writes the final EOF byte, closes the underlying stream.
|
void |
flush()
Flushes accumulated data bytes, if any.
|
private void |
writeBuf() |
public static final int CHUNK_SIZE
public static final byte EOF
public static final int DATA_MAX
public static final int DATA_USHORT
public static final int DATA_INT
public static final int COPY_USHORT_UBYTE
public static final int COPY_USHORT_USHORT
public static final int COPY_USHORT_INT
public static final int COPY_INT_UBYTE
public static final int COPY_INT_USHORT
public static final int COPY_INT_INT
public static final int COPY_LONG_INT
private java.io.ByteArrayOutputStream buf
private boolean debug
private java.io.DataOutputStream output
public GDiffWriter(java.io.DataOutputStream os) throws java.io.IOException
java.io.IOException
public GDiffWriter(java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public void addCopy(long offset, int length) throws java.io.IOException
DiffWriter
addCopy
in interface DiffWriter
java.io.IOException
public void addData(byte b) throws java.io.IOException
addData
in interface DiffWriter
java.io.IOException
private void writeBuf() throws java.io.IOException
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface DiffWriter
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface DiffWriter
java.io.IOException