MCPcopy
hub / github.com/google/brotli / encode

Method encode

java/org/brotli/wrapper/enc/Encoder.java:165–190  ·  view source on GitHub ↗

@return true if there is space in inputBuffer.

(EncoderJNI.Operation op)

Source from the content-addressed store, hash-verified

163 * @return true if there is space in inputBuffer.
164 */
165 boolean encode(EncoderJNI.Operation op) throws IOException {
166 boolean force = (op != EncoderJNI.Operation.PROCESS);
167 if (force) {
168 ((Buffer) inputBuffer).limit(inputBuffer.position());
169 } else if (inputBuffer.hasRemaining()) {
170 return true;
171 }
172 boolean hasInput = true;
173 while (true) {
174 if (!encoder.isSuccess()) {
175 fail("encoding failed");
176 } else if (!pushOutput(force)) {
177 return false;
178 } else if (encoder.hasMoreOutput()) {
179 buffer = encoder.pull();
180 } else if (encoder.hasRemainingInput()) {
181 encoder.push(op, 0);
182 } else if (hasInput) {
183 encoder.push(op, inputBuffer.limit());
184 hasInput = false;
185 } else {
186 ((Buffer) inputBuffer).clear();
187 return true;
188 }
189 }
190 }
191
192 void flush() throws IOException {
193 encode(EncoderJNI.Operation.FLUSH);

Callers 5

flushMethod · 0.95
closeMethod · 0.95
upperCase1Method · 0.80
writeMethod · 0.80
writeMethod · 0.80

Calls 7

failMethod · 0.95
pushOutputMethod · 0.95
isSuccessMethod · 0.80
hasMoreOutputMethod · 0.80
hasRemainingInputMethod · 0.80
pullMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected