private void deserializeStringTable() throws SerializationException { int typeNameCount = readInt(); BoundedList<String> buffer = new BoundedList<String>(String.class, typeNameCount); for (int typeNameIndex = 0; typeNameIndex < typeNameCount; ++typeNameIndex) { String str = extract(); str = buf.toString(); buffer.add(str); if (buffer.size() != buffer.getExpectedSize()) { throw new SerializationException("Expected " + buffer.getExpectedSize() + " string table elements; received " + buffer.size()); stringTable = buffer.toArray(new String[buffer.getExpectedSize()]);
/** * Convert a BoundedList to an array of the correct type. This * implementation consumes the BoundedList. */ protected Object toArray(Class<?> componentType, BoundedList<Object> buffer) throws SerializationException { if (buffer.getExpectedSize() != buffer.size()) { throw new SerializationException("Inconsistent number of elements received. Received " + buffer.size() + " but expecting " + buffer.getExpectedSize()); } Object arr = Array.newInstance(componentType, buffer.size()); for (int i = 0, n = buffer.size(); i < n; i++) { setSingleValue(arr, i, buffer.removeFirst()); } return arr; }
private void deserializeStringTable() throws SerializationException { int typeNameCount = readInt(); BoundedList<String> buffer = new BoundedList<String>(String.class, typeNameCount); for (int typeNameIndex = 0; typeNameIndex < typeNameCount; ++typeNameIndex) { String str = extract(); str = buf.toString(); buffer.add(str); if (buffer.size() != buffer.getExpectedSize()) { throw new SerializationException("Expected " + buffer.getExpectedSize() + " string table elements; received " + buffer.size()); stringTable = buffer.toArray(new String[buffer.getExpectedSize()]);
private void deserializeStringTable() throws SerializationException { int typeNameCount = readInt(); BoundedList<String> buffer = new BoundedList<String>(String.class, typeNameCount); for (int typeNameIndex = 0; typeNameIndex < typeNameCount; ++typeNameIndex) { String str = extract(); str = buf.toString(); buffer.add(str); if (buffer.size() != buffer.getExpectedSize()) { throw new SerializationException("Expected " + buffer.getExpectedSize() + " string table elements; received " + buffer.size()); stringTable = buffer.toArray(new String[buffer.getExpectedSize()]);
int length = readInt(); return new BoundedList<Object>(instanceClass.getComponentType(), length); } else if (instanceClass.isEnum()) { Enum<?>[] enumConstants = (Enum[]) instanceClass.getEnumConstants();
int length = readInt(); return new BoundedList<Object>(instanceClass.getComponentType(), length); } else if (instanceClass.isEnum()) { Enum<?>[] enumConstants = (Enum[]) instanceClass.getEnumConstants();
/** * Convert a BoundedList to an array of the correct type. This * implementation consumes the BoundedList. */ protected Object toArray(Class<?> componentType, BoundedList<Object> buffer) throws SerializationException { if (buffer.getExpectedSize() != buffer.size()) { throw new SerializationException("Inconsistent number of elements received. Received " + buffer.size() + " but expecting " + buffer.getExpectedSize()); } Object arr = Array.newInstance(componentType, buffer.size()); for (int i = 0, n = buffer.size(); i < n; i++) { setSingleValue(arr, i, buffer.removeFirst()); } return arr; }
/** * Convert a BoundedList to an array of the correct type. This * implementation consumes the BoundedList. */ protected Object toArray(Class<?> componentType, BoundedList<Object> buffer) throws SerializationException { if (buffer.getExpectedSize() != buffer.size()) { throw new SerializationException("Inconsistent number of elements received. Received " + buffer.size() + " but expecting " + buffer.getExpectedSize()); } Object arr = Array.newInstance(componentType, buffer.size()); for (int i = 0, n = buffer.size(); i < n; i++) { setSingleValue(arr, i, buffer.removeFirst()); } return arr; }
@Override public boolean add(T o) { assert size() < getExpectedSize(); return super.add(o); }
Object read(ServerSerializationStreamReader stream, BoundedList<Object> instance, Type expectedType, DequeMap<TypeVariable<?>, Type> resolvedTypes) throws SerializationException { for (int i = 0, n = instance.getExpectedSize(); i < n; ++i) { instance.add(readSingleValue(stream, expectedType, resolvedTypes)); } return toArray(instance.getComponentType(), instance); } }
Object read(ServerSerializationStreamReader stream, BoundedList<Object> instance, Type expectedType, DequeMap<TypeVariable<?>, Type> resolvedTypes) throws SerializationException { for (int i = 0, n = instance.getExpectedSize(); i < n; ++i) { instance.add(readSingleValue(stream, expectedType, resolvedTypes)); } return toArray(instance.getComponentType(), instance); } }
@Override public boolean add(T o) { assert size() < getExpectedSize(); return super.add(o); }
Object read(ServerSerializationStreamReader stream, BoundedList<Object> instance) throws SerializationException { for (int i = 0, n = instance.getExpectedSize(); i < n; ++i) { instance.add(readSingleValue(stream)); } return toArray(instance.getComponentType(), instance); }
Object read(ServerSerializationStreamReader stream, BoundedList<Object> instance) throws SerializationException { for (int i = 0, n = instance.getExpectedSize(); i < n; ++i) { instance.add(readSingleValue(stream)); } return toArray(instance.getComponentType(), instance); }
int length = readInt(); return new BoundedList<Object>(instanceClass.getComponentType(), length); } else if (instanceClass.isEnum()) { Enum<?>[] enumConstants = (Enum[]) instanceClass.getEnumConstants();
@Override public boolean add(T o) { assert size() < getExpectedSize(); return super.add(o); }
Object read(ServerSerializationStreamReader stream, BoundedList<Object> instance, Type expectedType, DequeMap<TypeVariable<?>, Type> resolvedTypes) throws SerializationException { for (int i = 0, n = instance.getExpectedSize(); i < n; ++i) { instance.add(readSingleValue(stream, expectedType, resolvedTypes)); } return toArray(instance.getComponentType(), instance); } }
Object read(ServerSerializationStreamReader stream, BoundedList<Object> instance) throws SerializationException { for (int i = 0, n = instance.getExpectedSize(); i < n; ++i) { instance.add(readSingleValue(stream)); } return toArray(instance.getComponentType(), instance); }