Code example for CharBuffer

Methods: array, arrayOffset, hasArray, limit, position

0
    //------------------------------------------ 
    // private utility methods 
    //------------------------------------------ 
 
    private final int getArray(CharBuffer out){
        if(out.hasArray()){
            output = out.array();
            outEnd = out.limit();
            return out.position();
        }else{ 
            outEnd = out.remaining();
            // BEGIN android-added 
            if (allocatedOutput == null || (outEnd > allocatedOutput.length)) {
                allocatedOutput = new char[outEnd];
            } 
            output = allocatedOutput;
            // END android-added 
            //since the new  
            // buffer start position  
            // is 0 
            return 0;