public CharBuffer put(CharBuffer src) { if (src instanceof DirectCharBufferS) { if (src == this) throw new IllegalArgumentException(); DirectCharBufferS sb = (DirectCharBufferS) src; int spos = sb.position(); int slim = sb.limit(); assert (spos <= slim); int srem = (spos <= slim ? slim - spos : 0); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (srem > rem) throw new BufferOverflowException(); unsafe.copyMemory(sb.ix(spos), ix(pos), srem << 1); sb.position(spos + srem); position(pos + srem); } else if (!src.isDirect()) { int spos = src.position(); int slim = src.limit(); assert (spos <= slim); int srem = (spos <= slim ? slim - spos : 0); put(src.hb, src.offset + spos, srem); src.position(spos + srem); } else { super.put(src); } return this; }
protected long computeEstimatedMemorySize() { long result = 0; if (!textArray.isDirect()) result += (Character.SIZE / 8) * textArray.capacity(); result += (Integer.SIZE / 8) * textIndexArray.length; result += (Double.SIZE / 8) * latlonArray.length; return result; }