package com.trendrr.nsq;
/**
 * 
 */

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * @author Dustin Norlander
 * @created Jan 14, 2013
 * 
 */
public class NSQCommand {

	protected static Logger log = LoggerFactory.getLogger(NSQCommand.class);

	public static NSQCommand instance(String line) {
		NSQCommand n = new NSQCommand();
		n.setLine(line);
		return n;
	}
	
	public static NSQCommand instance(String line, byte[] bytes) {
		NSQCommand n = instance(line);
		n.addBytes(bytes);
		return n;
	}
	
	String line;
	List<byte[]> data = new ArrayList<byte[]>();
	
	public void addBytes(byte[] bytes) {
		data.add(bytes);
	}
	
	public String getLine() {
		return line;
	}
	public void setLine(String line) {
		if (!line.endsWith("\n")) {
			line = line +"\n";
		}
		
		this.line = line;
	}
	public List<byte[]> getData() {
		return data;
	}
	public void setData(List<byte[]> data) {
		this.data = data;
	}
	
}

@@ -970,10 +970,105 @@
 a;%0A%09%7D%0A%09%0A
+%09public String toString() %7B%0A%09%09return super.toString() + %22 (%22 + this.getLine().trim() + %22)%22;%0A%09%7D%0A
 %7D%0A

add tostring