private DeltaEncoder newEncoder(OutputStream out, long resSize, int limit) throws IOException { return new DeltaEncoder(out, getSourceSize(), resSize, limit); }
p = encodeCopy(p, offset, MAX_V2_COPY); offset += MAX_V2_COPY; cnt -= MAX_V2_COPY; p = encodeCopy(p, offset, cnt); if (limit != 0 && limit < size + p) return false;
/** * Insert a literal binary sequence. * * @param text * the binary to insert. * @return true if the insert fits within the limit; false if the insert * would cause the instruction stream to exceed the limit. * @throws java.io.IOException * the instruction buffer can't store the instructions. */ public boolean insert(byte[] text) throws IOException { return insert(text, 0, text.length); }
/** * Create an encoder with an upper limit on the instruction size. * * @param out * buffer to store the instructions written. * @param baseSize * size of the base object, in bytes. * @param resultSize * size of the resulting object, after applying this instruction * stream to the base object, in bytes. * @param 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. * @throws java.io.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 { this.out = out; this.limit = limit; writeVarint(baseSize); writeVarint(resultSize); }
/** * Create an encoder with an upper limit on the instruction size. * * @param out * buffer to store the instructions written. * @param baseSize * size of the base object, in bytes. * @param resultSize * size of the resulting object, after applying this instruction * stream to the base object, in bytes. * @param 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. * @throws java.io.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 { this.out = out; this.limit = limit; writeVarint(baseSize); writeVarint(resultSize); }
/** * Insert a literal string of text, in UTF-8 encoding. * * @param text * the string to insert. * @return true if the insert fits within the limit; false if the insert * would cause the instruction stream to exceed the limit. * @throws java.io.IOException * the instruction buffer can't store the instructions. */ public boolean insert(String text) throws IOException { return insert(Constants.encode(text)); }
private DeltaEncoder newEncoder(OutputStream out, long resSize, int limit) throws IOException { return new DeltaEncoder(out, getSourceSize(), resSize, limit); }
/** * Create an encoder with an upper limit on the instruction size. * * @param out * buffer to store the instructions written. * @param baseSize * size of the base object, in bytes. * @param resultSize * size of the resulting object, after applying this instruction * stream to the base object, in bytes. * @param 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. * @throws 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 { this.out = out; this.limit = limit; writeVarint(baseSize); writeVarint(resultSize); }
p = encodeCopy(p, offset, MAX_V2_COPY); offset += MAX_V2_COPY; cnt -= MAX_V2_COPY; p = encodeCopy(p, offset, cnt); if (limit != 0 && limit < size + p) return false;
/** * Insert a literal binary sequence. * * @param text * the binary to insert. * @return true if the insert fits within the limit; false if the insert * would cause the instruction stream to exceed the limit. * @throws IOException * the instruction buffer can't store the instructions. */ public boolean insert(byte[] text) throws IOException { return insert(text, 0, text.length); }
private DeltaEncoder newEncoder(OutputStream out, long resSize, int limit) throws IOException { return new DeltaEncoder(out, getSourceSize(), resSize, limit); }
p = encodeCopy(p, offset, MAX_V2_COPY); offset += MAX_V2_COPY; cnt -= MAX_V2_COPY; p = encodeCopy(p, offset, cnt); if (limit != 0 && limit < size + p) return false;
/** * Insert a literal binary sequence. * * @param text * the binary to insert. * @return true if the insert fits within the limit; false if the insert * would cause the instruction stream to exceed the limit. * @throws java.io.IOException * the instruction buffer can't store the instructions. */ public boolean insert(byte[] text) throws IOException { return insert(text, 0, text.length); }
/** * Insert a literal string of text, in UTF-8 encoding. * * @param text * the string to insert. * @return true if the insert fits within the limit; false if the insert * would cause the instruction stream to exceed the limit. * @throws IOException * the instruction buffer can't store the instructions. */ public boolean insert(String text) throws IOException { return insert(Constants.encode(text)); }
/** * Insert a literal string of text, in UTF-8 encoding. * * @param text * the string to insert. * @return true if the insert fits within the limit; false if the insert * would cause the instruction stream to exceed the limit. * @throws java.io.IOException * the instruction buffer can't store the instructions. */ public boolean insert(String text) throws IOException { return insert(Constants.encode(text)); }