code: public static long readPID(File f, boolean carefulProcessing) throws IOException
  	{
  		if (f.exists())
  		{
  			String pidString = cat(f);
  
  			if (carefulProcessing)
  				pidString = pidString.replaceAll("[^0-9]", ""); // Strip out anything that's not a number
  			else
  				pidString = pidString.replace("\n", ""); // Just remove newlines
  
  			if (pidString.length() > 0)
  				return Long.parseLong(pidString);
  			else
  				return -1;
  		}
  		else
  		{
  			return -1;
  		}
  	}
docs: Reads a PID (Process Id) file
  
  @param f
  File The process Id file (must exist!)
  @param carefulProcessing
  boolean If true, non-numeric chars are stripped from the PID before it is parsed
  
  @return String The process Id represented by the file (or -1 if the file doesn't exist)
  
  @throws IOException
  On filesystem-level errors