src/main/java/org/nustaq/serialization/coders/FSTBytezDecoder.java
@Override
    public Object readFPrimitiveArray(Object array, Class componentType, int len) {
        // FIXME: if else chaining could be avoided
        if (componentType == byte.class) {
            ensureReadAhead(len);
            byte arr[] = (byte[]) array;
            input.getArr(pos, arr, 0, len);
            pos += len;
            return arr;
        } else if (componentType == char.class) {
            ensureReadAhead(len*2);
            char[] arr = (char[]) array;
            input.getCharArr(pos, arr, 0, len);
            pos += len * 2;
            return arr;
        } else if (componentType == short.class) {
            ensureReadAhead(len*2);
            short[] arr = (short[]) array;
            input.getShortArr(pos, arr, 0, len);
            pos += len * 2;
            return arr;
        } else if (componentType == int.class) {
            ensureReadAhead(len*4);
            int[] arr = (int[]) array;
            input.getIntArr(pos, arr, 0, len);
            pos += len * 4;
            return arr;
        } else if (componentType == float.class) {
            ensureReadAhead(len*4);
            float[] arr = (float[]) array;
            input.getFloatArr(pos, arr, 0, len);
            pos += len * 4;
            return arr;
        } else if (componentType == double.class) {
            ensureReadAhead(len*8);
            double[] arr = (double[]) array;
            input.getDoubleArr(pos, arr, 0, len);
            pos += len * 8;
            return arr;
        } else if (componentType == long.class) {
            ensureReadAhead(len*8);
            long[] arr = (long[]) array;
            input.getLongArr(pos, arr, 0, len);
            pos += len * 8;
            return arr;
        } else if (componentType == boolean.class) {
            ensureReadAhead(len);
            boolean[] arr = (boolean[]) array;
            input.getBooleanArr(pos, arr, 0, len);
            pos += len;
            return arr;
        } else {
            throw new RuntimeException("unexpected primitive type " + componentType.getName());
        }
    }
@Override
    public Object readFPrimitiveArray(Object array, Class componentType, int len) {
        // FIXME: if else chaining could be avoided
        if (componentType == byte.class) {
            ensureReadAhead(len);
            byte arr[] = (byte[]) array;
            input.getArr(pos, arr, 0, len);
            pos += len;
            return arr;
        } else if (componentType == char.class) {
            ensureReadAhead(len*2);
            char[] arr = (char[]) array;
            input.getCharArr(pos, arr, 0, len);
            pos += len * 2;
            return arr;
        } else if (componentType == short.class) {
            ensureReadAhead(len*2);
            short[] arr = (short[]) array;
            input.getShortArr(pos, arr, 0, len);
            pos += len * 2;
            return arr;
        } else if (componentType == int.class) {
            ensureReadAhead(len*4);
            int[] arr = (int[]) array;
            input.getIntArr(pos, arr, 0, len);
            pos += len * 4;
            return arr;
        } else if (componentType == float.class) {
            ensureReadAhead(len*4);
            float[] arr = (float[]) array;
            input.getFloatArr(pos, arr, 0, len);
            pos += len * 4;
            return arr;
        } else if (componentType == double.class) {
            ensureReadAhead(len*8);
            double[] arr = (double[]) array;
            input.getDoubleArr(pos, arr, 0, len);
            pos += len * 8;
            return arr;
        } else if (componentType == long.class) {
            ensureReadAhead(len*8);
            long[] arr = (long[]) array;
            input.getLongArr(pos, arr, 0, len);
            pos += len * 8;
            return arr;
        } else if (componentType == boolean.class) {
            ensureReadAhead(len);
            boolean[] arr = (boolean[]) array;
            input.getBooleanArr(pos, arr, 0, len);
            pos += len;
            return arr;
        } else {
            throw new RuntimeException("unexpected primitive type " + componentType.getName());
        }
    }
@ Override public Object readFPrimitiveArray ( Object array , Class componentType , int len ) { // FIXME: if else chaining could be avoided if ( componentType == byte . class ) { ensureReadAhead ( len ) ; byte arr [ ] = ( byte [ ] ) array ; input . getArr ( pos , arr , 0 , len ) ; pos += len ; return arr ; } else if ( componentType == char . class ) { ensureReadAhead ( len * 2 ) ; char [ ] arr = ( char [ ] ) array ; input . getCharArr ( pos , arr , 0 , len ) ; pos += len * 2 ; return arr ; } else if ( componentType == short . class ) { ensureReadAhead ( len * 2 ) ; short [ ] arr = ( short [ ] ) array ; input . getShortArr ( pos , arr , 0 , len ) ; pos += len * 2 ; return arr ; } else if ( componentType == int . class ) { ensureReadAhead ( len * 4 ) ; int [ ] arr = ( int [ ] ) array ; input . getIntArr ( pos , arr , 0 , len ) ; pos += len * 4 ; return arr ; } else if ( componentType == float . class ) { ensureReadAhead ( len * 4 ) ; float [ ] arr = ( float [ ] ) array ; input . getFloatArr ( pos , arr , 0 , len ) ; pos += len * 4 ; return arr ; } else if ( componentType == double . class ) { ensureReadAhead ( len * 8 ) ; double [ ] arr = ( double [ ] ) array ; input . getDoubleArr ( pos , arr , 0 , len ) ; pos += len * 8 ; return arr ; } else if ( componentType == long . class ) { ensureReadAhead ( len * 8 ) ; long [ ] arr = ( long [ ] ) array ; input . getLongArr ( pos , arr , 0 , len ) ; pos += len * 8 ; return arr ; } else if ( componentType == boolean . class ) { ensureReadAhead ( len ) ; boolean [ ] arr = ( boolean [ ] ) array ; input . getBooleanArr ( pos , arr , 0 , len ) ; pos += len ; return arr ; } else { throw new RuntimeException ( "unexpected primitive type " + componentType . getName ( ) ) ; } }
assumes class header+len already read

@param componentType
@param len
@return
assumes class header + len already read