package org.richfaces.realworld.fileupload;

import java.io.IOException;
import java.io.OutputStream;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Name("fileLoader")
@Scope(ScopeType.CONVERSATION)
public class FileLoader {

	@In
	FileWrapper fileWrapper;
	public synchronized void paint(OutputStream stream, Object object) throws IOException {
		stream.write(fileWrapper.getFiles().get((Integer)object).getData());
	}
}
