@Test public void testDeserializeStream() throws Exception { List<Integer> numbers = range(100000).toList(); FileBackedOutputStream outputStream = new FileBackedOutputStream(10); try (BinarySerializationOutput output = new BinarySerializationOutput(outputStream)) { for (Integer integer : numbers) { serializationManager.serialize(integer, output); } } BinarySerializationInput input = new BinarySerializationInput(outputStream.asByteSource().openBufferedStream()); List<Integer> result = serializationManager.<Integer> deserializeStream(input).toList(); assertEquals(numbers, result); }
public <T> Sequence<T> deserializeStream(final SerializationInput input) { return new NullTerminatedSequence<T>() { @Override protected T getNext() { try { return input.available() > 0 ? SerializationManager.this.<T> deserialize(input) : null; } catch (IOException | SerializationException e) { logger.warn("Failed to deserialize object", e); throw new RuntimeException(e); } } }; }
SerializationManager { public <T> Sequence<T> deserializeStream(final SerializationInput input) { return new NullTerminatedSequence<T>() { @Override protected T getNext() { try { return input.available() > 0 ? SerializationManager.this.<T> deserialize(input) : null; } catch (IOException | SerializationException e) { logger.warn("Failed to deserialize object", e); throw new RuntimeException(e); } } }; } }
SerializationManager { public <T> Sequence<T> deserializeStream(final SerializationInput input) { return new NullTerminatedSequence<T>() { @Override protected T getNext() { try { return input.available() > 0 ? SerializationManager.this.<T> deserialize(input) : null; } catch (IOException | SerializationException e) { logger.warn("Failed to deserialize object", e); throw new RuntimeException(e); } } }; } protected  SerializationManager(); protected  SerializationManager(Iterable<ObjectSerializer<?>> serializers); }
SerializationManager { public <T> Sequence<T> deserializeStream(final SerializationInput input) { return new NullTerminatedSequence<T>() { @Override protected T getNext() { try { return input.available() > 0 ? SerializationManager.this.<T> deserialize(input) : null; } catch (IOException | SerializationException e) { logger.warn("Failed to deserialize object", e); throw new RuntimeException(e); } } }; } protected  SerializationManager(); protected  SerializationManager(Iterable<ObjectSerializer<?>> serializers); void register(ObjectSerializer<T> serializer); void registerAdditional(ObjectSerializer<T> serializer); void registerOverride(ObjectSerializer<T> serializer); void unregister(ObjectSerializer<T> serializer); void serialize(T object, SerializationOutput output); void serializeStream(Iterable<T> object, SerializationOutput output); void serializeWrapExceptions(T object, File file); void serialize(T object, File file); @SuppressWarnings("unchecked") T deserialize(SerializationInput input); Sequence<T> deserializeStream(final SerializationInput input); T deserializeWrapExceptions(File file); T deserialize(File file); T deserialize(InputStream stream); SerializationInput getAppropriateSerializationInput(File file); static SerializationManager createDefault(); }
SerializationManager { public <T> Sequence<T> deserializeStream(final SerializationInput input) { return new NullTerminatedSequence<T>() { @Override protected T getNext() { try { return input.available() > 0 ? SerializationManager.this.<T> deserialize(input) : null; } catch (IOException | SerializationException e) { logger.warn("Failed to deserialize object", e); throw new RuntimeException(e); } } }; } protected  SerializationManager(); protected  SerializationManager(Iterable<ObjectSerializer<?>> serializers); void register(ObjectSerializer<T> serializer); void registerAdditional(ObjectSerializer<T> serializer); void registerOverride(ObjectSerializer<T> serializer); void unregister(ObjectSerializer<T> serializer); void serialize(T object, SerializationOutput output); void serializeStream(Iterable<T> object, SerializationOutput output); void serializeWrapExceptions(T object, File file); void serialize(T object, File file); @SuppressWarnings("unchecked") T deserialize(SerializationInput input); Sequence<T> deserializeStream(final SerializationInput input); T deserializeWrapExceptions(File file); T deserialize(File file); T deserialize(InputStream stream); SerializationInput getAppropriateSerializationInput(File file); static SerializationManager createDefault();  }