private void copyResource(InputStream resource, File file) 
	{
		try
		{
			OutputStream out = new FileOutputStream(file);

			int length;
			byte[] buf = new byte[1024];

			while((length = resource.read(buf)) > 0)
				out.write(buf, 0, length);

			out.close();
			resource.close();
		}
		catch (Exception e) {e.printStackTrace();}
	}