There are 2 code examples for java.nio.charset.CoderResult.
The API names are highlighted below.
You can use
button
to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.
Project Name: jnode-core Package: org.jnode.util
Source Code: WriterOutputStream.java (Click to view .java file)
Method Code:
private synchronized int flush(boolean all) throws IOException {
if (bytes.position() > 0) {
bytes.flip();
chars.clear();
CoderResult cr=decoder.decode(bytes,chars,all);
int count=chars.position();
if (count > 0) {
int pos=chars.arrayOffset();
writer.write(chars.array(),pos,count);
}
if (cr.isError() || (all && cr == CoderResult.UNDERFLOW)) {
cr.throwException();
}
if (bytes.remaining() > 0) {
byte[] tmp=new byte[bytes.remaining()];
bytes.get(tmp);
bytes.clear();
bytes.put(tmp);
}
else {
bytes.clear();
}
return count;
}
else {
return 0;
}
}
Project Name: jnode-core Package: org.jnode.util
Source Code: ReaderInputStream.java (Click to view .java file)
Method Code:
private void resetAndThrowOnError() throws CharacterCodingException {
encoder.reset();
if (cr != null && cr.isError()) {
for (int i=0; i < cr.length(); i++) {
chars.get();
}
CoderResult tmp=cr;
cr=null;
tmp.throwException();
}
}