@@ -0,0 +1,1278 @@
+/**%0A * Copyright (c) 2011-2014 hammerc.org%0A * See LICENSE.txt for full license information.%0A */%0Apackage org.hammerc.marble.utils;%0A%0Aimport java.io.DataInputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.nio.file.FileSystem;%0A%0A/**%0A * %E6%89%93%E5%8C%85%E5%88%B0 Jar %E5%86%85%E9%83%A8%E7%9A%84%E6%96%87%E4%BB%B6%E8%8E%B7%E5%8F%96%E7%B1%BB.%0A * @author wizardc%0A */%0Apublic class EmbedFileReader%0A%7B%0A%09/**%0A%09 * %E6%89%93%E5%BC%80%E6%96%87%E4%BB%B6%E7%9A%84%E7%AE%80%E4%BE%BF%E6%96%B9%E6%B3%95.%0A%09 * @param path %E6%96%87%E4%BB%B6%E5%AE%8C%E6%95%B4%E8%B7%AF%E5%BE%84%E5%90%8D.%0A%09 * @return %E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9.%0A%09 * @throws IOException %E8%AF%BB%E5%86%99%E5%BC%82%E5%B8%B8%E6%97%B6%E6%8A%9B%E5%87%BA.%0A%09 */%0A%09public static byte%5B%5D readAsBytes(String path) throws IOException%0A%09%7B%0A%09%09InputStream inputStream = FileSystem.class.getClass().getResourceAsStream(path);%0A%09%09DataInputStream dataInputStream = new DataInputStream(inputStream);%0A%09%09byte%5B%5D bytes = new byte%5BdataInputStream.available()%5D;%0A%09%09dataInputStream.read(bytes);%0A%09%09return bytes;%0A%09%7D%0A%09%0A%09/**%0A%09 * %E6%89%93%E5%BC%80%E6%96%87%E4%BB%B6%E7%9A%84%E7%AE%80%E4%BE%BF%E6%96%B9%E6%B3%95.%0A%09 * @param path %E6%96%87%E4%BB%B6%E5%AE%8C%E6%95%B4%E8%B7%AF%E5%BE%84%E5%90%8D.%0A%09 * @return %E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9.%0A%09 * @throws IOException %E8%AF%BB%E5%86%99%E5%BC%82%E5%B8%B8%E6%97%B6%E6%8A%9B%E5%87%BA.%0A%09 */%0A%09public static String readAsString(String path) throws IOException%0A%09%7B%0A%09%09return readAsString(path, %22UTF8%22);%0A%09%7D%0A%09%0A%09/**%0A%09 * %E6%89%93%E5%BC%80%E6%96%87%E4%BB%B6%E7%9A%84%E7%AE%80%E4%BE%BF%E6%96%B9%E6%B3%95.%0A%09 * @param path %E6%96%87%E4%BB%B6%E5%AE%8C%E6%95%B4%E8%B7%AF%E5%BE%84%E5%90%8D.%0A%09 * @param charsetName %E7%BC%96%E7%A0%81%E6%A0%BC%E5%BC%8F.%0A%09 * @return %E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9.%0A%09 * @throws IOException %E8%AF%BB%E5%86%99%E5%BC%82%E5%B8%B8%E6%97%B6%E6%8A%9B%E5%87%BA.%0A%09 */%0A%09public static String readAsString(String path, String charsetName) throws IOException%0A%09%7B%0A%09%09byte%5B%5D bytes = readAsBytes(path);%0A%09%09return new String(bytes, charsetName);%0A%09%7D%0A%7D%0A

添加内嵌文件读取类。