Angsuman's Java Blog

News and views from my perspective as a Chief Software Architect and CEO. Focused on Java and Web Technologies.


Thursday, September 18, 2003

Simple yet Useful: Unix Tail implementation in Java



Free code for your to enjoy... do drop me an email if you find this useful.


import java.io.*;
public class Tail {
public static void main(String args[]) throws Exception {
FileInputStream file = new FileInputStream(args[0]);
int ch;
while(true) {
while((ch = file.read()) != -1) System.out.write((char) ch);
Thread.sleep(1000);
}
}
}

I would welcome suggestions on how to make it simpler.