} } private final int getArray(CharBuffer in) { if(in.hasArray()){ // BEGIN android-changed: take arrayOffset into account input = in.array(); inEnd = in.arrayOffset() + in.limit(); return in.arrayOffset() + in.position() + savedInputHeldLen;/*exclude the number fo bytes held in previous conversion*/ // END android-changed }else{ inEnd = in.remaining(); // BEGIN android-added if (allocatedInput == null || (inEnd > allocatedInput.length)) { allocatedInput = new char[inEnd]; } input = allocatedInput; // END android-added // save the current position int pos = in.position(); in.get(input,0,inEnd); // reset the position in.position(pos); // the start position // of the new buffer // is whatever is savedInputLen return savedInputHeldLen;