Code example for RandomAccessFile

Methods: close, length, readByte, seek

0
	 * @return 
	 * @throws Exception 
	 */ 
	public static boolean fileEndsWithNewlineChar(File inFile) throws Exception
	{ 
		RandomAccessFile raf = new RandomAccessFile(inFile, "r");
		try 
		{ 
			raf.seek(raf.length() - 1);
			char c = (char) raf.readByte();
			if (c == '\n' || c == '\r')
			{ 
				return true; 
			} 
			else 
			{ 
				return false; 
			} 
		} 
		finally 
		{ 
			raf.close();
		} 
	} 
 
	/** 
	 * Get the amount of newline characters at the end of a file. Can be of