public class DeltaEncoder extends Object
BinaryDelta.| Constructor and Description |
|---|
DeltaEncoder(OutputStream out,
long baseSize,
long resultSize)
Create an encoder with no upper bound on the instruction stream size.
|
DeltaEncoder(OutputStream out,
long baseSize,
long resultSize,
int limit)
Create an encoder with an upper limit on the instruction size.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
copy(long offset,
int cnt)
Create a copy instruction to copy from the base object.
|
int |
getSize() |
boolean |
insert(byte[] text)
Insert a literal binary sequence.
|
boolean |
insert(byte[] text,
int off,
int cnt)
Insert a literal binary sequence.
|
boolean |
insert(String text)
Insert a literal string of text, in UTF-8 encoding.
|
public DeltaEncoder(OutputStream out, long baseSize, long resultSize) throws IOException
out - buffer to store the instructions written.baseSize - size of the base object, in bytes.resultSize - size of the resulting object, after applying this instruction
stream to the base object, in bytes.IOException - the output buffer cannot store the instruction stream's
header with the size fields.public DeltaEncoder(OutputStream out, long baseSize, long resultSize, int limit) throws IOException
out - buffer to store the instructions written.baseSize - size of the base object, in bytes.resultSize - size of the resulting object, after applying this instruction
stream to the base object, in bytes.limit - maximum number of bytes to write to the out buffer declaring
the stream is over limit and should be discarded. May be 0 to
specify an infinite limit.IOException - the output buffer cannot store the instruction stream's
header with the size fields.public int getSize()
public boolean insert(String text) throws IOException
text - the string to insert.IOException - the instruction buffer can't store the instructions.public boolean insert(byte[] text)
throws IOException
text - the binary to insert.IOException - the instruction buffer can't store the instructions.public boolean insert(byte[] text,
int off,
int cnt)
throws IOException
text - the binary to insert.off - offset within text to start copying from.cnt - number of bytes to insert.IOException - the instruction buffer can't store the instructions.public boolean copy(long offset,
int cnt)
throws IOException
offset - position in the base object to copy from. This is absolute,
from the beginning of the base.cnt - number of bytes to copy.IOException - the instruction buffer cannot store the instructions.Copyright © 2013. All rights reserved.