将String写入文件，追加模式

@param content 写入的内容
@param path 文件路径
@param charset 字符集
@return 写入的文件
@throws IORuntimeException IO异常
183415
public static File appendString(String content, String path, String charset) throws IORuntimeException {
		return appendString(content, touch(path), charset);
	}
468396
def read(path, encoding="utf-8"):
    
    with open(path, "rb") as f:
        content = f.read()
        try:
            text = content.decode(encoding)
        except:
            res = chardet.detect(content)
            text = content.decode(res["encoding"])
    return text
1059200
@Override
	public Set<InputStream> getResourcesAsStream(final String path) throws IOException
	{
		// First, try the path as specified
		final Set<InputStream> streams = inner.getResourcesAsStream(path);

		// If no results were found and the path was absolute, retry without the leading slash
		if ((streams == null || streams.isEmpty()) && !path.isEmpty() && path.charAt(0) == '/')
		{
			// Strip the leading slash away and re-try the path
			// This lets us
			final String newPath = path.substring(1);

			return inner.getResourcesAsStream(newPath);
		}
		else
		{
			return streams;
		}
	}
978893
public static void write(String path, String str) throws IOException {
		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
				path), "utf8"));
		out.append(str);
		out.close();		
	}
1168907
public static <T> File writeLines(Collection<T> list, String path, String charset) throws IORuntimeException {
		return writeLines(list, path, charset, false);
	}
400601
public static void writeStringToFile(String contents, String path, String encoding) throws IOException {
		OutputStream writer = null;
		if (path.endsWith(".gz")) {
      writer = new GZIPOutputStream(new FileOutputStream(path));
    } else {
      writer = new BufferedOutputStream(new FileOutputStream(path));
    }
		writer.write(contents.getBytes(encoding));
	}
70590
public static List<String> readStringList(String filePath, Charset charset) throws IOException {
        FileInputStream stream = new FileInputStream(filePath);
        return readStringList(stream, charset);
    }
1007404
public static String read(FileChannel fileChannel, String charsetName) throws IORuntimeException {
		return read(fileChannel, CharsetUtil.charset(charsetName));
	}
1266963
public static String readFileContentToString(String filePath)
            throws IOException {
        String content = "";
        content = Files.toString(new File(filePath), Charsets.UTF_8);
        return content;
    }
1318842
public static List<String> listFileNames(String path) throws IORuntimeException {
		if (path == null) {
			return null;
		}
		List<String> paths = new ArrayList<String>();

		int index = path.lastIndexOf(FileUtil.JAR_PATH_EXT);
		if (index == -1) {
			// 普通目录路径
			File[] files = ls(path);
			for (File file : files) {
				if (file.isFile()) {
					paths.add(file.getName());
				}
			}
		} else {
			// jar文件
			path = getAbsolutePath(path);
			if (false == StrUtil.endWith(path, UNIX_SEPARATOR)) {
				path = path + UNIX_SEPARATOR;
			}
			// jar文件中的路径
			index = index + FileUtil.JAR_FILE_EXT.length();
			JarFile jarFile = null;
			try {
				jarFile = new JarFile(path.substring(0, index));
				final String subPath = path.substring(index + 2);
				for (JarEntry entry : Collections.list(jarFile.entries())) {
					final String name = entry.getName();
					if (name.startsWith(subPath)) {
						final String nameSuffix = StrUtil.removePrefix(name, subPath);
						if (false == StrUtil.contains(nameSuffix, UNIX_SEPARATOR)) {
							paths.add(nameSuffix);
						}
					}
				}
			} catch (IOException e) {
				throw new IORuntimeException(StrUtil.format("Can not read file path of [{}]", path), e);
			} finally {
				IoUtil.close(jarFile);
			}
		}
		return paths;
	}
516172
public static File writeUtf8String(String content, File file) throws IORuntimeException {
		return writeString(content, file, CharsetUtil.CHARSET_UTF_8);
	}
688411
public static List<String> readUtf8Lines(String path) throws IORuntimeException {
		return readLines(path, CharsetUtil.CHARSET_UTF_8);
	}
1349102
public static void saveFile(String path, String content) throws IOException {
        saveFile(path, content, false);
    }
870067
public String getFileContents(String path) throws Exception {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        Resources.copy(Pages.class.getResource(path), outputStream);
        return new String(outputStream.toByteArray(), "UTF-8");
    }
144815
public static File appendString(String content, File file, String charset) throws IORuntimeException {
		return FileWriter.create(file, CharsetUtil.charset(charset)).append(content);
	}
491727
public RFuture<String> getText (final String path) {
    final RPromise<String> result = exec.deferredPromise();
    exec.invokeAsync(new Runnable() {
      public void run () {
        try {
          result.succeed(getTextSync(path));
        } catch (Throwable t) {
          result.fail(t);
        }
      }
    });
    return result;
  }
764483
public static BufferedWriter getWriter(String path, String charsetName, boolean isAppend) throws IORuntimeException {
		return getWriter(touch(path), Charset.forName(charsetName), isAppend);
	}