package mmbn;
import rand.ByteStream;
import rand.DataProducer;

public class FolderProducer implements DataProducer<Folder> {
    protected final RewardProducer rewardProducer;
    
    public FolderProducer(RewardProducer rewardProducer) {
        this.rewardProducer = rewardProducer;
    }
    
    @Override
    public Folder readFromStream(ByteStream stream) {
        Folder folder = new Folder();
        
        while (folder.isFull()) {
            folder.addChip(this.rewardProducer.readFromStream(stream));
        }
        
        return folder;
    }

    @Override
    public void writeToStream(ByteStream stream, Folder folder) {
        for (Reward chip : folder.getChips()) {
            this.rewardProducer.writeToStream(stream, chip);
        }
    }
    
    public ChipLibrary library() {
        return this.rewardProducer.library();
    }
}

@@ -422,16 +422,17 @@
  while (
+!
 folder.i

Fix bug with folders not loading.