import java.io.IOException;
import java.io.InputStream;

public class SerialReader implements Runnable{
	
	InputStream in;
	
	public static String Data = "";
	
	public SerialReader(InputStream in) {
		this.in = in;
	}
	
	public void run() {
		
		byte[] buffer = new byte[1024];
		
		int len = -1;
		
		try {
			
			while ((len = this.in.read(buffer)) > -1) {
				
				String iaa = new String(buffer, 0, len);
				
				if (iaa.equals("1")) {
					
					System.out.println("Arduino - Data : " + iaa);
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
