MCPcopy Create free account
hub / github.com/davidgiven/luje / decode

Method decode

lib/java/nio/charset/CharsetDecoder.java:210–241  ·  view source on GitHub ↗

This is a facade method for the decoding operation. This method decodes the remaining byte sequence of the given byte buffer into a new character buffer. This method performs a complete decoding operation, resets at first, then decodes, and flushes at last. This method should not be invoked

(ByteBuffer in)

Source from the content-addressed store, hash-verified

208 * if another exception happened during the decode operation.
209 */
210 public final CharBuffer decode(ByteBuffer in)
211 throws CharacterCodingException {
212 reset();
213 int length = (int) (in.remaining() * averChars);
214 CharBuffer output = CharBuffer.allocate(length);
215 CoderResult result = null;
216 while (true) {
217 result = decode(in, output, false);
218 checkCoderResult(result);
219 if (result.isUnderflow()) {
220 break;
221 } else if (result.isOverflow()) {
222 output = allocateMore(output);
223 }
224 }
225 result = decode(in, output, true);
226 checkCoderResult(result);
227
228 while (true) {
229 result = flush(output);
230 checkCoderResult(result);
231 if (result.isOverflow()) {
232 output = allocateMore(output);
233 } else {
234 break;
235 }
236 }
237
238 output.flip();
239 status = FLUSH;
240 return output;
241 }
242
243 /*
244 * checks the result whether it needs to throw CharacterCodingException.

Callers

nothing calls this directly

Calls 15

resetMethod · 0.95
allocateMethod · 0.95
checkCoderResultMethod · 0.95
isUnderflowMethod · 0.95
isOverflowMethod · 0.95
allocateMoreMethod · 0.95
flushMethod · 0.95
decodeLoopMethod · 0.95
malformedForLengthMethod · 0.95
isUnmappableMethod · 0.95
lengthMethod · 0.95
remainingMethod · 0.80

Tested by

no test coverage detected