src/main/java/org/nustaq/serialization/minbin/MBIn.java
public Object readArrayRaw(byte type, int len, Object resultingArray) {
        Class componentType = resultingArray.getClass().getComponentType();
        if ( componentType == byte.class ) {
            byte[] barr = (byte[]) resultingArray;
            for ( int i = 0; i < len; i++ ) {
                barr[i] = (byte) readRawInt(type);
            }
        } else  if ( componentType == short.class ) {
            short[] sArr = (short[]) resultingArray;
            for ( int i = 0; i < len; i++ ) {
                sArr[i] = (short) readRawInt(type);
            }
        } else  if ( componentType == char.class ) {
            char[] cArr = (char[]) resultingArray;
            for (int i = 0; i < len; i++) {
                cArr[i] = (char) readRawInt(type);
            }
        } else  if ( componentType == int.class ) {
            int[] iArr = (int[]) resultingArray;
            for (int i = 0; i < len; i++) {
                iArr[i] = (int) readRawInt(type);
            }
        } else  if ( componentType == long.class ) {
            long[] lArr = (long[]) resultingArray;
            for (int i = 0; i < len; i++) {
                lArr[i] = readRawInt(type);
            }
        } else if ( componentType == boolean.class ) {
            boolean[] boolArr = (boolean[]) resultingArray;
            for (int i = 0; i < len; i++) {
                boolArr[i] = readRawInt(MinBin.INT_8) != 0;
            }
        } else
            throw new RuntimeException("unsupported array type "+resultingArray.getClass().getName());
        return resultingArray;
    }
public Object readArrayRaw(byte type, int len, Object resultingArray) {
        Class componentType = resultingArray.getClass().getComponentType();
        if ( componentType == byte.class ) {
            byte[] barr = (byte[]) resultingArray;
            for ( int i = 0; i < len; i++ ) {
                barr[i] = (byte) readRawInt(type);
            }
        } else  if ( componentType == short.class ) {
            short[] sArr = (short[]) resultingArray;
            for ( int i = 0; i < len; i++ ) {
                sArr[i] = (short) readRawInt(type);
            }
        } else  if ( componentType == char.class ) {
            char[] cArr = (char[]) resultingArray;
            for (int i = 0; i < len; i++) {
                cArr[i] = (char) readRawInt(type);
            }
        } else  if ( componentType == int.class ) {
            int[] iArr = (int[]) resultingArray;
            for (int i = 0; i < len; i++) {
                iArr[i] = (int) readRawInt(type);
            }
        } else  if ( componentType == long.class ) {
            long[] lArr = (long[]) resultingArray;
            for (int i = 0; i < len; i++) {
                lArr[i] = readRawInt(type);
            }
        } else if ( componentType == boolean.class ) {
            boolean[] boolArr = (boolean[]) resultingArray;
            for (int i = 0; i < len; i++) {
                boolArr[i] = readRawInt(MinBin.INT_8) != 0;
            }
        } else
            throw new RuntimeException("unsupported array type "+resultingArray.getClass().getName());
        return resultingArray;
    }
public Object readArrayRaw ( byte type , int len , Object resultingArray ) { Class componentType = resultingArray . getClass ( ) . getComponentType ( ) ; if ( componentType == byte . class ) { byte [ ] barr = ( byte [ ] ) resultingArray ; for ( int i = 0 ; i < len ; i ++ ) { barr [ i ] = ( byte ) readRawInt ( type ) ; } } else if ( componentType == short . class ) { short [ ] sArr = ( short [ ] ) resultingArray ; for ( int i = 0 ; i < len ; i ++ ) { sArr [ i ] = ( short ) readRawInt ( type ) ; } } else if ( componentType == char . class ) { char [ ] cArr = ( char [ ] ) resultingArray ; for ( int i = 0 ; i < len ; i ++ ) { cArr [ i ] = ( char ) readRawInt ( type ) ; } } else if ( componentType == int . class ) { int [ ] iArr = ( int [ ] ) resultingArray ; for ( int i = 0 ; i < len ; i ++ ) { iArr [ i ] = ( int ) readRawInt ( type ) ; } } else if ( componentType == long . class ) { long [ ] lArr = ( long [ ] ) resultingArray ; for ( int i = 0 ; i < len ; i ++ ) { lArr [ i ] = readRawInt ( type ) ; } } else if ( componentType == boolean . class ) { boolean [ ] boolArr = ( boolean [ ] ) resultingArray ; for ( int i = 0 ; i < len ; i ++ ) { boolArr [ i ] = readRawInt ( MinBin . INT_8 ) != 0 ; } } else throw new RuntimeException ( "unsupported array type " + resultingArray . getClass ( ) . getName ( ) ) ; return resultingArray ; }
read into preallocated array, allows to write to different type (e.g. boolean[] from byte[])
@param type type tag.
@param len
@param resultingArray
@return
read into preallocated array allows to write to different type ( e . g . boolean [] from byte [] )