if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (strings.length != requiredSize)
- throw new IOException("Wrong number of bytes. size says "
- + requiredSize + ", data contains "
+ throw new IOException("Wrong number of bytes for '" + name
+ + "'. size says " + requiredSize
+ + ", data contains "
+ strings.length);
}
byte[] tmp = new byte[strings.length];
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (strings.length != requiredSize)
- throw new IOException("Wrong number of ints. size says "
- + requiredSize + ", data contains "
- + strings.length);
+ throw new IOException("Wrong number of ints for '" + name
+ + "'. size says " + requiredSize
+ + ", data contains " + strings.length);
}
int[] tmp = new int[strings.length];
for (int i = 0; i < tmp.length; i++) {
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (strings.length != requiredSize)
- throw new IOException("Wrong number of floats. size says "
- + requiredSize + ", data contains "
- + strings.length);
+ throw new IOException("Wrong number of floats for '" + name
+ + "'. size says " + requiredSize
+ + ", data contains " + strings.length);
}
float[] tmp = new float[strings.length];
for (int i = 0; i < tmp.length; i++) {
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (strings.length != requiredSize)
- throw new IOException("Wrong number of doubles. size says "
- + requiredSize + ", data contains "
- + strings.length);
+ throw new IOException("Wrong number of doubles for '"
+ + name + "'. size says " + requiredSize
+ + ", data contains " + strings.length);
}
double[] tmp = new double[strings.length];
for (int i = 0; i < tmp.length; i++) {
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (strings.length != requiredSize)
- throw new IOException("Wrong number of longs. size says "
- + requiredSize + ", data contains "
- + strings.length);
+ throw new IOException("Wrong number of longs for '" + name
+ + "'. size says " + requiredSize
+ + ", data contains " + strings.length);
}
long[] tmp = new long[strings.length];
for (int i = 0; i < tmp.length; i++) {
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (strings.length != requiredSize)
- throw new IOException("Wrong number of shorts. size says "
- + requiredSize + ", data contains "
- + strings.length);
+ throw new IOException("Wrong number of shorts for '"
+ + name + "'. size says " + requiredSize
+ + ", data contains " + strings.length);
}
short[] tmp = new short[strings.length];
for (int i = 0; i < tmp.length; i++) {
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (strings.length != requiredSize)
- throw new IOException("Wrong number of bools. size says "
- + requiredSize + ", data contains "
- + strings.length);
+ throw new IOException("Wrong number of bools for '" + name
+ + "'. size says " + requiredSize
+ + ", data contains " + strings.length);
}
boolean[] tmp = new boolean[strings.length];
for (int i = 0; i < tmp.length; i++) {
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (savables.size() != requiredSize)
- throw new IOException("Wrong number of Savables. size says "
- + requiredSize + ", data contains "
- + savables.size());
+ throw new IOException("Wrong number of Savables for '"
+ + name + "'. size says " + requiredSize
+ + ", data contains " + savables.size());
}
ret = savables.toArray(new Savable[0]);
}
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (savables.size() != requiredSize)
- throw new IOException("Wrong number of Savable rrays. size says "
- + requiredSize + ", data contains "
- + savables.size());
+ throw new IOException(
+ "Wrong number of Savable arrays for '" + name
+ + "'. size says " + requiredSize
+ + ", data contains " + savables.size());
}
currentElem = (Element) tmpEl.getParentNode();
return savables;
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (strings.length != requiredSize)
- throw new IOException("Wrong number of float buffers. size says "
- + requiredSize + ", data contains "
- + strings.length);
+ throw new IOException("Wrong number of float buffers for '"
+ + name + "'. size says " + requiredSize
+ + ", data contains " + strings.length);
}
FloatBuffer tmp = BufferUtils.createFloatBuffer(strings.length);
for (String s : strings) tmp.put(Float.parseFloat(s));
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (strings.length != requiredSize)
- throw new IOException("Wrong number of int buffers. size says "
- + requiredSize + ", data contains "
- + strings.length);
+ throw new IOException("Wrong number of int buffers for '"
+ + name + "'. size says " + requiredSize
+ + ", data contains " + strings.length);
}
IntBuffer tmp = BufferUtils.createIntBuffer(strings.length);
for (String s : strings) tmp.put(Integer.parseInt(s));
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (strings.length != requiredSize)
- throw new IOException("Wrong number of byte buffers. size says "
- + requiredSize + ", data contains "
- + strings.length);
+ throw new IOException("Wrong number of byte buffers for '"
+ + name + "'. size says " + requiredSize
+ + ", data contains " + strings.length);
}
ByteBuffer tmp = BufferUtils.createByteBuffer(strings.length);
for (String s : strings) tmp.put(Byte.valueOf(s));
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (strings.length != requiredSize)
- throw new IOException("Wrong number of short buffers. size says "
- + requiredSize + ", data contains "
- + strings.length);
+ throw new IOException("Wrong number of short buffers for '"
+ + name + "'. size says " + requiredSize
+ + ", data contains " + strings.length);
}
ShortBuffer tmp = BufferUtils.createShortBuffer(strings.length);
for (String s : strings) tmp.put(Short.valueOf(s));
if (sizeString.length() > 0) {
int requiredSize = Integer.parseInt(sizeString);
if (tmp.size() != requiredSize)
- throw new IOException("Wrong number of short buffers. size says "
- + requiredSize + ", data contains "
- + tmp.size());
+ throw new IOException("Wrong number of short buffers for '"
+ + name + "'. size says " + requiredSize
+ + ", data contains " + tmp.size());
}
currentElem = (Element) tmpEl.getParentNode();
return tmp;
StringBuilder buf = new StringBuilder();
int pos = value.position();
value.rewind();
+ int ctr = 0;
while (value.hasRemaining()) {
+ ctr++;
buf.append(value.get());
buf.append(" ");
}
+ if (ctr != value.limit())
+ throw new IOException("'" + name
+ + "' buffer contention resulted in write data consistency. "
+ + ctr + " values written when should have written "
+ + value.limit());
buf.setLength(Math.max(0, buf.length() - 1));
value.position(pos);
el.setAttribute(dataAttributeName, buf.toString());
StringBuilder buf = new StringBuilder();
int pos = value.position();
value.rewind();
+ int ctr = 0;
while (value.hasRemaining()) {
+ ctr++;
buf.append(value.get());
buf.append(" ");
}
+ if (ctr != value.limit())
+ throw new IOException("'" + name
+ + "' buffer contention resulted in write data consistency. "
+ + ctr + " values written when should have written "
+ + value.limit());
buf.setLength(buf.length() - 1);
value.position(pos);
el.setAttribute(dataAttributeName, buf.toString());
StringBuilder buf = new StringBuilder();
int pos = value.position();
value.rewind();
+ int ctr = 0;
while (value.hasRemaining()) {
+ ctr++;
buf.append(value.get());
buf.append(" ");
}
+ if (ctr != value.limit())
+ throw new IOException("'" + name
+ + "' buffer contention resulted in write data consistency. "
+ + ctr + " values written when should have written "
+ + value.limit());
buf.setLength(buf.length() - 1);
value.position(pos);
el.setAttribute(dataAttributeName, buf.toString());
StringBuilder buf = new StringBuilder();
int pos = value.position();
value.rewind();
+ int ctr = 0;
while (value.hasRemaining()) {
+ ctr++;
buf.append(value.get());
buf.append(" ");
}
+ if (ctr != value.limit())
+ throw new IOException("'" + name
+ + "' buffer contention resulted in write data consistency. "
+ + ctr + " values written when should have written "
+ + value.limit());
buf.setLength(buf.length() - 1);
value.position(pos);
el.setAttribute(dataAttributeName, buf.toString());