BinaryInputCapsule cap = new BinaryInputCapsule(this, out, bco); cap.setContent(dataArray, loc, loc+dataLength);
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; }
@SuppressWarnings("unchecked") public IntMap<? extends Savable> readIntSavableMap(String name, IntMap<? extends Savable> defVal) throws IOException { BinaryClassField field = cObj.nameFields.get(name); if (field == null || !fieldData.containsKey(field.alias)) return defVal; Object value = fieldData.get(field.alias); if (value instanceof IntIDMap) { // read Savable array and convert to Map values IntIDMap in = (IntIDMap) value; Savable[] values = resolveIDs(in.values); value = intSavableMapFromKV(in.keys, values); fieldData.put(field.alias, value); } return (IntMap<Savable>) 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 boolean[][] readBooleanArray2D(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] = readBooleanArray(content); return value; }
value = readBitSet(content); break; value = readBoolean(content); break; value = readBooleanArray(content); break; value = readBooleanArray2D(content); break; value = readByte(content); break; value = readByteArray(content); break; value = readByteArray2D(content); break; value = readByteBuffer(content); break; value = readDouble(content); break; value = readDoubleArray(content); break;
protected byte[][] readByteArray2D(byte[] content) throws IOException { int length = readInt(content); if (length == BinaryOutputCapsule.NULL_OBJECT) return null; byte[][] value = new byte[length][]; for (int x = 0; x < length; x++) value[x] = readByteArray(content); return value; }
value = readBitSet(content); break; value = readBoolean(content); break; value = readBooleanArray(content); break; value = readBooleanArray2D(content); break; value = readByte(content); break; value = readByteArray(content); break; value = readByteArray2D(content); break; value = readByteBuffer(content); break; value = readDouble(content); break; value = readDoubleArray(content); break;
protected BitSet readBitSet(byte[] content) throws IOException { int length = readInt(content); if (length == BinaryOutputCapsule.NULL_OBJECT) return null; BitSet value = new BitSet(length); for (int x = 0; x < length; x++) value.set(x, readBoolean(content)); return value; }
protected boolean[][] readBooleanArray2D(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] = readBooleanArray(content); return value; }
protected byte[][] readByteArray2D(byte[] content) throws IOException { int length = readInt(content); if (length == BinaryOutputCapsule.NULL_OBJECT) return null; byte[][] value = new byte[length][]; for (int x = 0; x < length; x++) value[x] = readByteArray(content); return value; }
value = readBitSet(content); break; value = readBoolean(content); break; value = readBooleanArray(content); break; value = readBooleanArray2D(content); break; value = readByte(content); break; value = readByteArray(content); break; value = readByteArray2D(content); break; value = readByteBuffer(content); break; value = readDouble(content); break; value = readDoubleArray(content); break;
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 boolean[][] readBooleanArray2D(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] = readBooleanArray(content); return value; }
protected byte[][] readByteArray2D(byte[] content) throws IOException { int length = readInt(content); if (length == BinaryOutputCapsule.NULL_OBJECT) return null; byte[][] value = new byte[length][]; for (int x = 0; x < length; x++) value[x] = readByteArray(content); return value; }
@SuppressWarnings("unchecked") public IntMap<? extends Savable> readIntSavableMap(String name, IntMap<? extends Savable> defVal) throws IOException { BinaryClassField field = cObj.nameFields.get(name); if (field == null || !fieldData.containsKey(field.alias)) return defVal; Object value = fieldData.get(field.alias); if (value instanceof IntIDMap) { // read Savable array and convert to Map values IntIDMap in = (IntIDMap) value; Savable[] values = resolveIDs(in.values); value = intSavableMapFromKV(in.keys, values); fieldData.put(field.alias, value); } return (IntMap<Savable>) value; }
BinaryInputCapsule cap = new BinaryInputCapsule(this, out, bco); cap.setContent(dataArray, loc, loc+dataLength);