private Object readBinaryArray(int index, int count) throws SQLException {
int dimensions = ByteConverter.int4(fieldBytes, 0);
int elementOid = ByteConverter.int4(fieldBytes, 8);
int pos = 12;
int[] dims = new int[dimensions];
for (int d = 0; d < dimensions; ++d) {
dims[d] = ByteConverter.int4(fieldBytes, pos);
pos += 4;
pos += 4;
}
if (dimensions == 0) {
return java.lang.reflect.Array.newInstance(elementOidToClass(elementOid), 0);
}
if (count > 0) {
dims[0] = Math.min(count, dims[0]);
}
Object arr = java.lang.reflect.Array.newInstance(elementOidToClass(elementOid), dims);
try {
storeValues((Object[]) arr, elementOid, dims, pos, 0, index);
} catch (IOException ioe) {
throw new PSQLException(
GT.tr(
"Invalid character data was found. This is most likely caused by stored data containing characters that are invalid for the character set the database was created in. The most common example of this is storing 8bit data in a SQL_ASCII database."),
PSQLState.DATA_ERROR, ioe);
}
return arr;
}