Code example for File

Methods: delete, exists, length

0
		public void abort() 
		{ 
			// Only truly abort if we didn't write the whole length 
			// This works around a bug where Android calls abort() 
			// whenever the file is closed, successful writes or not 
			if (bFile.length() != this.contentLength) {
				Log.e(TAG, "Failed to add item to the cache!");
				if (bFile.exists()) bFile.delete();
				if (hFile.exists()) hFile.delete();
			} 
		} 
	} 
 
	public static boolean peek(URI uri)
	{ 
		TiResponseCache rc = (TiResponseCache) TiResponseCache.getDefault();
		if (rc == null) return false;
		if (rc.cacheDir == null) return false;
		 
		String hash = DigestUtils.shaHex(uri.toString());
		File hFile = new File(rc.cacheDir, hash + HEADER_SUFFIX);