use of org.w3c.dom.Element in project jmonkeyengine by jMonkeyEngine.
the class DOMOutputCapsule method write.
@Override
public void write(boolean[][] value, String name, boolean[][] defVal) throws IOException {
if (value == null)
return;
if (Arrays.deepEquals(value, defVal))
return;
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
for (int i = 0; i < value.length; i++) {
boolean[] array = value[i];
write(array, "array_" + i, defVal == null ? null : defVal[i]);
}
currentElement = (Element) el.getParentNode();
}
use of org.w3c.dom.Element in project jmonkeyengine by jMonkeyEngine.
the class DOMOutputCapsule method write.
@Override
public void write(byte[][] value, String name, byte[][] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
value = defVal;
}
for (byte[] bs : value) {
for (byte b : bs) {
buf.append(b);
buf.append(" ");
}
buf.append(" ");
}
if (buf.length() > 1) {
//remove last spaces
buf.setLength(buf.length() - 2);
} else if (buf.length() > 0) {
buf.setLength(buf.length() - 1);
}
Element el = appendElement(name);
el.setAttribute("size_outer", String.valueOf(value.length));
el.setAttribute("size_inner", String.valueOf(value[0].length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
use of org.w3c.dom.Element in project jmonkeyengine by jMonkeyEngine.
the class DOMOutputCapsule method writeByteBufferArrayList.
@Override
public void writeByteBufferArrayList(ArrayList<ByteBuffer> array, String name, ArrayList<ByteBuffer> defVal) throws IOException {
if (array == null) {
return;
}
if (array.equals(defVal)) {
return;
}
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(array.size()));
for (ByteBuffer o : array) {
write(o, "ByteBuffer", null);
}
currentElement = (Element) el.getParentNode();
}
use of org.w3c.dom.Element in project jmonkeyengine by jMonkeyEngine.
the class DOMOutputCapsule method write.
@Override
public void write(long[] value, String name, long[] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
value = defVal;
}
for (long b : value) {
buf.append(b);
buf.append(" ");
}
if (buf.length() > 0) {
//remove last space
buf.setLength(buf.length() - 1);
}
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
use of org.w3c.dom.Element in project jmonkeyengine by jMonkeyEngine.
the class DOMOutputCapsule method write.
@Override
public void write(double[] value, String name, double[] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
value = defVal;
}
for (double b : value) {
buf.append(b);
buf.append(" ");
}
if (buf.length() > 0) {
//remove last space
buf.setLength(buf.length() - 1);
}
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
Aggregations