@Override
    public Object read(Input input) {
        int length = input.readShort();
        Class arrayElementType = input.read();
        if (arrayElementType.isPrimitive()) {
            if (int.class.equals(arrayElementType)) {
                return readIntArray(input, length);
            } else if (long.class.equals(arrayElementType)) {
                return readLongArray(input, length);
            } else if (boolean.class.equals(arrayElementType)) {
                return readBooleanArray(input, length);
            } else if (double.class.equals(arrayElementType)) {
                return readDoubleArray(input, length);
            } else if (float.class.equals(arrayElementType)) {
                return readFloatArray(input, length);
            } else if (byte.class.equals(arrayElementType)) {
                return readByteArray(input, length);
            } else if (short.class.equals(arrayElementType)) {
                return readShortArray(input, length);
            } else if (char.class.equals(arrayElementType)) {
                return readCharArray(input, length);
            }
        }
        return readObjectArray(input, length, arrayElementType);
    }