protected StringIDMap readStringSavableMap(byte[] content) throws IOException { int elements = readInt(content); if (elements == BinaryOutputCapsule.NULL_OBJECT) return null; String[] keys = readStringArray(content); ID[] values = readSavableArray(content); StringIDMap rVal = new StringIDMap(); rVal.keys = keys; rVal.values = values; return rVal; }
protected int readInt(byte[] content) throws IOException { byte[] bytes = inflateFrom(content, index); index += 1 + bytes.length; bytes = ByteUtils.rightAlignBytes(bytes, 4); int value = ByteUtils.convertIntFromBytes(bytes); if (value == BinaryOutputCapsule.NULL_OBJECT || value == BinaryOutputCapsule.DEFAULT_OBJECT) index -= 4; return value; }
protected long readLong(byte[] content) throws IOException { byte[] bytes = inflateFrom(content, index); index += 1 + bytes.length; bytes = ByteUtils.rightAlignBytes(bytes, 8); long value = ByteUtils.convertLongFromBytes(bytes); return value; }
protected IntIDMap readIntSavableMap(byte[] content) throws IOException { int elements = readInt(content); if (elements == BinaryOutputCapsule.NULL_OBJECT) return null; int[] keys = readIntArray(content); ID[] values = readSavableArray(content); IntIDMap rVal = new IntIDMap(); rVal.keys = keys; rVal.values = values; return rVal; }
public void write(short[][] value, String name, short[][] defVal) throws IOException { if (value == defVal) return; writeAlias(name, BinaryClassField.SHORT_2D); write(value); }
protected void write(Savable object) throws IOException { if (object == null) { write(NULL_OBJECT); return; } int id = exporter.processBinarySavable(object); write(id); }
protected BinaryIdContentPair generateIdContentPair(BinaryClassObject bco) { BinaryIdContentPair pair = new BinaryIdContentPair(idCount++, new BinaryOutputCapsule(this, bco)); return pair; } }
protected long[][] readLongArray2D(byte[] content) throws IOException { int length = readInt(content); if (length == BinaryOutputCapsule.NULL_OBJECT) return null; long[][] value = new long[length][]; for (int x = 0; x < length; x++) value[x] = readLongArray(content); return value; }
protected boolean[] readBooleanArray(byte[] content) throws IOException { int length = readInt(content); if (length == BinaryOutputCapsule.NULL_OBJECT) return null; boolean[] value = new boolean[length]; for (int x = 0; x < length; x++) value[x] = readBoolean(content); return value; }
protected String[] readStringArray(byte[] content) throws IOException { int length = readInt(content); if (length == BinaryOutputCapsule.NULL_OBJECT) return null; String[] value = new String[length]; for (int x = 0; x < length; x++) value[x] = readString(content); return value; }
protected ID[] readSavableArray(byte[] content) throws IOException { int elements = readInt(content); if (elements == BinaryOutputCapsule.NULL_OBJECT) return null; ID[] rVal = new ID[elements]; for (int x = 0; x < elements; x++) { rVal[x] = readSavable(content); } return rVal; }
protected float readFloat(byte[] content) throws IOException { float value = ByteUtils.convertFloatFromBytes(content, index); index += 4; return value; }
public void write(boolean[][] value, String name, boolean[][] defVal) throws IOException { if (value == defVal) return; writeAlias(name, BinaryClassField.BOOLEAN_2D); write(value); }