import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;


public class LogEntryWritable implements Writable{
	private Text dateTime;
	private Text fileSystem;
	private LongWritable spaceAllocated;
	private LongWritable spaceUsed;
	
	public LogEntryWritable(){ 
		this(new Text(), new Text(), new LongWritable(), new LongWritable());
	}
	
	public LogEntryWritable(Text dateTime, Text fileSystem, 
						    LongWritable spaceAllocated, LongWritable spaceUsed){
		this.dateTime = dateTime;
		this.fileSystem = fileSystem;
		this.spaceAllocated = spaceAllocated;
		this.spaceUsed = spaceUsed;
	}
	
	public Text getDateTime() {
		return dateTime;
	}

	public Text getFileSystem() {
		return fileSystem;
	}

	public LongWritable getSpaceAllocated() {
		return spaceAllocated;
	}

	public LongWritable getSpaceUsed() {
		return spaceUsed;
	}

	public String toString(){
		return(dateTime + " " + fileSystem + " " +
			   spaceAllocated + " " + spaceUsed);
	}
	
	public void readFields(DataInput in) throws IOException{
		dateTime.readFields(in);
		fileSystem.readFields(in);
		spaceAllocated.readFields(in);
		spaceUsed.readFields(in);
	}
	
	public void write(DataOutput out) throws IOException{
		dateTime.write(out);
		fileSystem.write(out);
		spaceAllocated.write(out);
		spaceUsed.write(out);
	}
}