将String写入文件，覆盖模式，字符集为UTF-8

@param content 写入的内容
@param file 文件
@return 写入的文件
@throws IORuntimeException IO异常
516172
public static File writeUtf8String(String content, File file) throws IORuntimeException {
		return writeString(content, file, CharsetUtil.CHARSET_UTF_8);
	}
338872
public static String readString(File file, String charsetName) throws IORuntimeException {
		return readString(file, CharsetUtil.charset(charsetName));
	}
130364
public static Content content(String somePlainText) {
		Content c = null;
		try {
			c = new Content("text/plain; charset=UTF-8", somePlainText.getBytes("UTF-8"));
		} catch (UnsupportedEncodingException e) { /* UTF-8 is never unsupported */
		}
		return c;
	}
182088
public CharBuffer getCachedContent(JavaFileObject file) {
        ContentCacheEntry e = contentCache.get(file);
        if (e == null)
            return null;

        if (!e.isValid(file)) {
            contentCache.remove(file);
            return null;
        }

        return e.getValue();
    }
359396
public static String getFileContent(String fileContent,String encoding){
		String fc = "";
		try {
			fc = new String(SDKUtil.inflater(SecureUtil.base64Decode(fileContent.getBytes())),encoding);
		} catch (UnsupportedEncodingException e) {
			LogUtil.writeErrorLog(e.getMessage(), e);
		} catch (IOException e) {
			LogUtil.writeErrorLog(e.getMessage(), e);
		}
		return fc;
	}
405859
@Override
	public String readStr(Charset charset) throws IORuntimeException{
		BufferedReader reader = null;
		try {
			reader = getReader(charset);
			return IoUtil.read(reader);
		} finally {
			IoUtil.close(reader);
		}
	}
557184
public static void readUtf8Lines(InputStream in, LineHandler lineHandler) throws IORuntimeException {
		readLines(in, CharsetUtil.CHARSET_UTF_8, lineHandler);
	}
439396
public static Map<String, File> loadStringToFileMap(final File f) throws IOException {
    return loadStringToFileMap(Files.asCharSource(f, Charsets.UTF_8));
  }
776205
public static byte[] addUtf8Marker(byte[] content) {

        if ((content != null)
            && (content.length >= 3)
            && (content[0] == UTF8_MARKER[0])
            && (content[1] == UTF8_MARKER[1])
            && (content[2] == UTF8_MARKER[2])) {
            return content;
        }

        if (content == null) {
            content = new byte[0];
        }

        byte[] ret = new byte[UTF8_MARKER.length + content.length];

        System.arraycopy(UTF8_MARKER, 0, ret, 0, UTF8_MARKER.length);
        System.arraycopy(content, 0, ret, UTF8_MARKER.length, content.length);

        return ret;
    }
214140
public static BufferedReader getReader(File file, Charset charset) throws IORuntimeException {
		return IoUtil.getReader(getInputStream(file), charset);
	}
1329375
public static void writeToFile(@NonNull File file, @NonNull String content) throws IOException {
    OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
    try {
      writer.write(content);
      writer.flush();
    } catch (IOException ioe) {
      Log.e(LOG_TAG, ioe.toString());
    } finally {
      try {
        writer.close();
      } catch (IOException ioe) {
        Log.e(LOG_TAG, ioe.toString());
      }
    }
  }
1146653
public static IResourceStream getResourceStream(final java.io.File file,
		final String contentType) throws IOException
	{
		return new ByteArrayResourceStreamWriter()
		{
			private static final long serialVersionUID = 1L;

			@Override
			public String getContentType()
			{
				return contentType;
			}

			@Override
			protected byte[] load() throws IOException
			{
				final byte[] data = Files.readBytes(file);
				return data;
			}
		};
	}
799007
public static String escape(String content) {
		if (StrUtil.isBlank(content)) {
			return content;
		}

		int i;
		char j;
		StringBuilder tmp = new StringBuilder();
		tmp.ensureCapacity(content.length() * 6);

		for (i = 0; i < content.length(); i++) {

			j = content.charAt(i);

			if (Character.isDigit(j) || Character.isLowerCase(j) || Character.isUpperCase(j)) {
				tmp.append(j);
			} else if (j < 256) {
				tmp.append("%");
				if (j < 16) {
					tmp.append("0");
				}
				tmp.append(Integer.toString(j, 16));
			} else {
				tmp.append("%u");
				tmp.append(Integer.toString(j, 16));
			}
		}
		return tmp.toString();
	}
487336
public static List<String> readUtf8Lines(File file) throws IORuntimeException {
		return readLines(file, CharsetUtil.CHARSET_UTF_8);
	}
1165546
public static String getImageAsDataUri(File file) throws IOException {
        String contentType = getContentType(file);
        String base64Content = getImageAsBase64(file);

        return "data:" + contentType + ";base64," + base64Content;
    }
638498
public static String getType(File file) throws IORuntimeException {
		FileInputStream in = null;
		try {
			in = IoUtil.toStream(file);
			return getType(in);
		} finally {
			IoUtil.close(in);
		}
	}
322617
public static List<String> readUtf8Lines(URL url) throws IORuntimeException {
		return readLines(url, CharsetUtil.CHARSET_UTF_8);
	}