package projectzombie.worker;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Vector;
import java.util.zip.GZIPOutputStream;

import bdf.types.BdfReader;
import projectzombie.settings.Environment;
import projectzombie.world.chunk.Chunk;

class WorkerTaskFile extends WorkerTask
{
	String path;
	BdfReader reader;
	
	public WorkerTaskFile(String path, BdfReader reader) {
		this.reader = reader;
		this.path = path;
	}

	@Override
	public void run()
	{
		try
		{
			OutputStream out = new GZIPOutputStream(new FileOutputStream(Environment.gdir + path));
			
			reader.serialize().writeToStream(out);
			
			out.close();
		}
		
		catch(IOException e) {
			e.printStackTrace();
		}
	}
}
