@Override
    public Object readFPrimitiveArray(Object array, Class componentType, int len) {
        try {
            if (componentType == byte.class) {
                byte[] arr = (byte[]) array;
                ensureReadAhead(arr.length); // fixme: move this stuff to the stream !
                System.arraycopy(input.buf,input.pos,arr,0,len);
                input.pos += len;
                return arr;
            } else if (componentType == int.class) {
                final int[] arr = (int[]) array;
                readFIntArr(len, arr);
                return arr;
            } else if (componentType == long.class) {
                long[] arr = (long[]) array;
                readFLongArr(len, arr);
                return arr;
            } else if (componentType == char.class) {
                char[] arr = (char[]) array;
                for (int j = 0; j < len; j++) {
                    arr[j] = readFChar();
                }
                return arr;
            } else if (componentType == double.class) {
                double[] arr = (double[]) array;
                ensureReadAhead(arr.length * 8);
                for (int j = 0; j < len; j++) {
                    arr[j] = readFDouble();
                }
                return arr;
            } else if (componentType == short.class) {
                short[] arr = (short[]) array;
                ensureReadAhead(arr.length * 2);
                for (int j = 0; j < len; j++) {
                    arr[j] = readFShort();
                }
                return arr;
            } else if (componentType == float.class) {
                float[] arr = (float[]) array;
                ensureReadAhead(arr.length * 4);
                for (int j = 0; j < len; j++) {
                    arr[j] = readFFloat();
                }
                return arr;
            } else if (componentType == boolean.class) {
                boolean[] arr = (boolean[]) array;
                ensureReadAhead(arr.length);
                for (int j = 0; j < len; j++) {
                    arr[j] = readFByte() == 0 ? false : true;
                }
                return arr;
            } else {
                throw new RuntimeException("unexpected primitive type " + componentType.getName());
            }
        } catch (IOException e) {
            LOGGER.log(FSTLogger.Level.ERROR, "Failed to read primitive array", e);
            FSTUtil.<RuntimeException>rethrow(e);
        }
        return null;
    }
@Override
    public Object readFPrimitiveArray(Object array, Class componentType, int len) {
        try {
            if (componentType == byte.class) {
                byte[] arr = (byte[]) array;
                ensureReadAhead(arr.length); 
                System.arraycopy(input.buf,input.pos,arr,0,len);
                input.pos += len;
                return arr;
            } else if (componentType == int.class) {
                final int[] arr = (int[]) array;
                readFIntArr(len, arr);
                return arr;
            } else if (componentType == long.class) {
                long[] arr = (long[]) array;
                readFLongArr(len, arr);
                return arr;
            } else if (componentType == char.class) {
                char[] arr = (char[]) array;
                for (int j = 0; j < len; j++) {
                    arr[j] = readFChar();
                }
                return arr;
            } else if (componentType == double.class) {
                double[] arr = (double[]) array;
                ensureReadAhead(arr.length * 8);
                for (int j = 0; j < len; j++) {
                    arr[j] = readFDouble();
                }
                return arr;
            } else if (componentType == short.class) {
                short[] arr = (short[]) array;
                ensureReadAhead(arr.length * 2);
                for (int j = 0; j < len; j++) {
                    arr[j] = readFShort();
                }
                return arr;
            } else if (componentType == float.class) {
                float[] arr = (float[]) array;
                ensureReadAhead(arr.length * 4);
                for (int j = 0; j < len; j++) {
                    arr[j] = readFFloat();
                }
                return arr;
            } else if (componentType == boolean.class) {
                boolean[] arr = (boolean[]) array;
                ensureReadAhead(arr.length);
                for (int j = 0; j < len; j++) {
                    arr[j] = readFByte() == 0 ? false : true;
                }
                return arr;
            } else {
                throw new RuntimeException("unexpected primitive type " + componentType.getName());
            }
        } catch (IOException e) {
            LOGGER.log(FSTLogger.Level.ERROR, "Failed to read primitive array", e);
            FSTUtil.<RuntimeException>rethrow(e);
        }
        return null;
    }
@ Override public Object readFPrimitiveArray ( Object array , Class componentType , int len ) { try { if ( componentType == byte . class ) { byte [ ] arr = ( byte [ ] ) array ; ensureReadAhead ( arr . length ) ; // fixme: move this stuff to the stream ! System . arraycopy ( input . buf , input . pos , arr , 0 , len ) ; input . pos += len ; return arr ; } else if ( componentType == int . class ) { final int [ ] arr = ( int [ ] ) array ; readFIntArr ( len , arr ) ; return arr ; } else if ( componentType == long . class ) { long [ ] arr = ( long [ ] ) array ; readFLongArr ( len , arr ) ; return arr ; } else if ( componentType == char . class ) { char [ ] arr = ( char [ ] ) array ; for ( int j = 0 ; j < len ; j ++ ) { arr [ j ] = readFChar ( ) ; } return arr ; } else if ( componentType == double . class ) { double [ ] arr = ( double [ ] ) array ; ensureReadAhead ( arr . length * 8 ) ; for ( int j = 0 ; j < len ; j ++ ) { arr [ j ] = readFDouble ( ) ; } return arr ; } else if ( componentType == short . class ) { short [ ] arr = ( short [ ] ) array ; ensureReadAhead ( arr . length * 2 ) ; for ( int j = 0 ; j < len ; j ++ ) { arr [ j ] = readFShort ( ) ; } return arr ; } else if ( componentType == float . class ) { float [ ] arr = ( float [ ] ) array ; ensureReadAhead ( arr . length * 4 ) ; for ( int j = 0 ; j < len ; j ++ ) { arr [ j ] = readFFloat ( ) ; } return arr ; } else if ( componentType == boolean . class ) { boolean [ ] arr = ( boolean [ ] ) array ; ensureReadAhead ( arr . length ) ; for ( int j = 0 ; j < len ; j ++ ) { arr [ j ] = readFByte ( ) == 0 ? false : true ; } return arr ; } else { throw new RuntimeException ( "unexpected primitive type " + componentType . getName ( ) ) ; } } catch ( IOException e ) { LOGGER . log ( FSTLogger . Level . ERROR , "Failed to read primitive array" , e ) ; FSTUtil . < RuntimeException > rethrow ( e ) ; } return null ; }
assumes class header+len already read

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