`ArrayReader` causes `ClassCastException` because of arrays covariance. The problem is caused by `val result = new Object[len];`