src/org/kocakosm/pitaya/io/TextFiles.java
public static List<String> tail(File f, int n, Charset charset)
		throws IOException
	{
		Parameters.checkCondition(n >= 0);
		if (n == 0) {
			return Collections.emptyList();
		}
		List<String> lines = new LinkedList<String>();
		BufferedReader reader = newReader(f, charset);
		try {
			String line = reader.readLine();
			while (line != null) {
				lines.add(line);
				if (lines.size() > n) {
					lines.remove(0);
				}
				line = reader.readLine();
			}
		} finally {
			IO.close(reader);
		}
		return Collections.unmodifiableList(lines);
	}
public static List<String> tail(File f, int n, Charset charset)
		throws IOException
	{
		Parameters.checkCondition(n >= 0);
		if (n == 0) {
			return Collections.emptyList();
		}
		List<String> lines = new LinkedList<String>();
		BufferedReader reader = newReader(f, charset);
		try {
			String line = reader.readLine();
			while (line != null) {
				lines.add(line);
				if (lines.size() > n) {
					lines.remove(0);
				}
				line = reader.readLine();
			}
		} finally {
			IO.close(reader);
		}
		return Collections.unmodifiableList(lines);
	}
public static List < String > tail ( File f , int n , Charset charset ) throws IOException { Parameters . checkCondition ( n >= 0 ) ; if ( n == 0 ) { return Collections . emptyList ( ) ; } List < String > lines = new LinkedList < String > ( ) ; BufferedReader reader = newReader ( f , charset ) ; try { String line = reader . readLine ( ) ; while ( line != null ) { lines . add ( line ) ; if ( lines . size ( ) > n ) { lines . remove ( 0 ) ; } line = reader . readLine ( ) ; } } finally { IO . close ( reader ) ; } return Collections . unmodifiableList ( lines ) ; }
Returns the last (up to n) lines of the given {@code File} using the
specified charset. Named after the Unix command of the same name.

@param f the {@code File} to read.
@param n the maximum number of lines to read.
@param charset the charset to use.

@return the last lines of the given {@code File}.

@throws NullPointerException if one of the arguments is {@code null}.
@throws IllegalArgumentException if {@code n} is negative.
@throws IOException if {@code f} does not exist, or if it is a
directory rather than a regular file, or if it can't be read.
@throws SecurityException if a security manager exists and denies
read access to {@code f}.
Returns the last ( up to n ) lines of the given { @code File } using the specified charset . Named after the Unix command of the same name .