将字符串写到文件
@param path
@param str
@throws IOException
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();		
	}
313480
public static String readFile(String path) throws IOException {
        if (path.startsWith(ValueConsts.CLASSPATH_PREFIX)) {
            return read(FileExecutor.class.getResourceAsStream(path.substring(ValueConsts.CLASSPATH_PREFIX.length())));
        }
        return readFile(new File(path));
    }
58590
public void writeToFile(String path) {
        try {
            try (OutputStream os = new FileOutputStream(path)) {
                InputStreams.transferTo(body(), os);
            }
        } catch (IOException e) {
            throw new RequestsException(e);
        } finally {
            close();
        }
    }
1196228
public static void writeBufferToFile(String path, byte[] buffer) throws IOException {
    try (FileOutputStream os = new FileOutputStream(path)) {
      os.write(buffer);
    }
  }
1089414
public static boolean saveTxt(String path, String content)
    {
        try
        {
            FileChannel fc = new FileOutputStream(path).getChannel();
            fc.write(ByteBuffer.wrap(content.getBytes()));
            fc.close();
        }
        catch (Exception e)
        {
            logger.throwing("IOUtil", "saveTxt", e);
            logger.warning("IOUtil saveTxt 到" + path + "失败" + e.toString());
            return false;
        }
        return true;
    }
720485
private static void createDirectory(Path path) throws IOException {
		try {
			Files.createDirectory(path);
		} catch (FileAlreadyExistsException e) {
			if (!Files.isDirectory(path)) {
				throw e;
			}
		}
	}
134616
public static String readStringFromFile(String path, Configuration hadoopConfig) throws IOException {
        FileSystem fileSystem = FileSystem.get(hadoopConfig);
        try (BufferedInputStream bis = new BufferedInputStream(fileSystem.open(new Path(path)))) {
            byte[] asBytes = IOUtils.toByteArray(bis);
            return new String(asBytes, "UTF-8");
        }
    }
1090178
@Override
	public void writeString(String str) throws IOException {
		byte[] bytes = Utf8.getBytesFor(str);
		writeBytes(bytes, 0, bytes.length);
	}
349312
public static void deleteFile(@Nullable Path path) throws IOException {
		Validate.isTrue(isFileExists(path), "%s is not exist or not a file", path);

		Files.delete(path);
	}
455890
public void init(String path, String charset) throws IOException {
		BufferedReader reader = FileUtil.getReader(path, charset);
		try {
			String line;
			while(true) {
				line = reader.readLine();
				if(line == null) {
					break;
				}
				this.add(line);
			}
		}finally {
			IoUtil.close(reader);
		}
	}
916362
public void readPOS(String path, String suffix, String charset) throws IOException {
		List<File> files = MyFiles.getAllFiles(path, suffix);//".txt"
		
		Iterator<File> it = files.iterator();
		while(it.hasNext()){
			BufferedReader bfr =null;
			File file = it.next();
			try {
				FileInputStream in = new FileInputStream(file);
				bfr = new BufferedReader(new UnicodeReader(in,charset));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
			FNLPDoc doc = new FNLPDoc();
			doc.name = file.getName();
			
			String line = null;
			while ((line = bfr.readLine()) != null) {
				line = line.trim();
				if (line.matches("^$"))
					continue;
				FNLPSent sent = new FNLPSent();
				sent.parseTagedLine(line);
				doc.add(sent);
			}			
			add(doc);
		}
	}
860384
public static void saveTo(String path, InputStream in) throws IOException {
        if (in == null)
            throw new IllegalArgumentException("input stream cannot be null");
        if (path == null)
            throw new IllegalArgumentException("path cannot be null");

        try (OutputStream out = new BufferedOutputStream(
                                        Files.newOutputStream(
                                                Paths.get(path), 
                                                StandardOpenOption.CREATE, 
                                                StandardOpenOption.APPEND))) {
            byte[] bytes = new byte[1024];
            for (int x = in.read(bytes); x != -1; x = in.read(bytes))
                out.write(bytes, 0, x);
        }
    }
688411
public static List<String> readUtf8Lines(String path) throws IORuntimeException {
		return readLines(path, CharsetUtil.CHARSET_UTF_8);
	}
355428
public static void writeTo(String path) throws IOException, NoSuchMethodException, IllegalAccessException,
            InvocationTargetException {
        createXwpfDocumentIfNull();
        MsUtils.writeTo(xwpfDocument, path);
    }
1026592
public static BufferedReader newBufferedReader(String path) throws IOException
    {
        return new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
    }
73841
public static void write(LogView logView, String path) throws IOException {
                String xml = xstream.toXML(logView);
                try (BufferedWriter out = new BufferedWriter(new FileWriter(path))) {
                        out.write(xml);
                }
        }
403036
public static File writeUtf8String(String content, String path) throws IORuntimeException {
		return writeString(content, path, CharsetUtil.CHARSET_UTF_8);
	}