141142143144145146147148149150151
src.reset(); found = false; break; } if (!(tgt.get() == src.get())) { tgt.reset(); src.reset(); found = false; break; // no match } }
146147148149150151152153154155
private static ByteBuffer directify(ByteBuffer dataBuf) { ByteBuffer newBuf = ByteBuffer.allocateDirect(dataBuf.capacity()); newBuf.position(dataBuf.position()); newBuf.mark(); newBuf.put(dataBuf); newBuf.reset(); newBuf.limit(dataBuf.limit()); return newBuf; } }
13171318131913201321132213231324132513261327
encode.mark(); int c1 = safeGet(encode); if (c1 == '\n' || (c1 == '\r' && (c1 = safeGet(encode)) == '\n')) continue; int d1 = Character.digit(c1, 16); if (d1 == -1) { encode.reset(); break; } encode.mark(); if (!encode.hasRemaining()) break; int c2 = safeGet(encode);
13251326132713281329133013311332133313341335
encode.mark(); if (!encode.hasRemaining()) break; int c2 = safeGet(encode); int d2 = Character.digit(c2, 16); if (d2 == -1) { encode.reset(); break; } byte value = (byte)(d1 << 4 | d2); lElem[index++] = value; }
8384858687888990919293
} else { // Slow path, if the byte buffer doesn't have array byte[] bytes = new byte[body.remaining()]; body.mark(); body.get(bytes); body.reset(); out.value(Bytes.toStringBinary(bytes)); } out.endObject(); }
104105106107108109110111112113114
} ByteBuffer dstbuf = dst.buffer; dstbuf.mark(); src.getBytes(src.readerIndex(), dstbuf); dstbuf.reset(); return dst; } private Preallocation getPreallocation() { Preallocation current = this.current;
918919920921922923924925926927928
// using that encoder. // try { return decode(b, Constants.CHARSET); } catch (CharacterCodingException e) { b.reset(); } if (!cs.equals(Constants.CHARSET)) { // Try the suggested encoding, it might be right since it was // provided by the caller.
928929930931932933934935936937938
// provided by the caller. // try { return decode(b, cs); } catch (CharacterCodingException e) { b.reset(); } } // Try the default character set. A small group of people // might actually use the same (or very similar) locale.
940941942943944945946947948949950
final Charset defcs = Charset.defaultCharset(); if (!defcs.equals(cs) && !defcs.equals(Constants.CHARSET)) { try { return decode(b, defcs); } catch (CharacterCodingException e) { b.reset(); } } throw new CharacterCodingException(); }
16891690169116921693169416951696169716981699
if ( remaining > nbStored ) { pageData.mark(); pageData.position( pagePos ); pageData.put( bytes, bytes.length - nbStored, nbStored ); pageData.reset(); nbStored = 0; } else { pageData.mark();