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

Method implCanEncode

lib/java/nio/charset/CharsetEncoder.java:224–246  ·  view source on GitHub ↗
(CharBuffer cb)

Source from the content-addressed store, hash-verified

222
223 // implementation of canEncode
224 private boolean implCanEncode(CharBuffer cb) {
225 if (status == FLUSH || status == INIT) {
226 status = READY;
227 }
228 if (status != READY) {
229 // niochar.0B=Another encoding process is ongoing\!
230 throw new IllegalStateException(Messages.getString("niochar.0B")); //$NON-NLS-1$
231 }
232 CodingErrorAction malformBak = malformAction;
233 CodingErrorAction unmapBak = unmapAction;
234 onMalformedInput(CodingErrorAction.REPORT);
235 onUnmappableCharacter(CodingErrorAction.REPORT);
236 boolean result = true;
237 try {
238 this.encode(cb);
239 } catch (CharacterCodingException e) {
240 result = false;
241 }
242 onMalformedInput(malformBak);
243 onUnmappableCharacter(unmapBak);
244 reset();
245 return result;
246 }
247
248 /**
249 * Checks if a given <code>CharSequence</code> can be encoded by this

Callers 1

canEncodeMethod · 0.95

Calls 5

getStringMethod · 0.95
onMalformedInputMethod · 0.95
onUnmappableCharacterMethod · 0.95
encodeMethod · 0.95
resetMethod · 0.95

Tested by

no test coverage detected