<commit_before>package org.voovan.tools;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;

import org.voovan.tools.log.Logger;

/**
 * 文件操作工具类
 * 
 * @author helyho
 *
 * Voovan Framework.
 * WebSite: https://github.com/helyho/Voovan
 * Licence: Apache v2 License
 */
public class TFile {
	
	/**
	 * 路径拼装
	 * @param pathParts 每个由路劲分割符分割的路径字符串
	 * @return
	 */
	public static String assemblyPath(String ...pathParts ){
		String result = "";
		for(String pathPart : pathParts){
			result = result+pathPart+File.separator;
		}
		
		return TString.removeSuffix(result);
	}
	
	/**
	 * 从系统路径读取文件内容
	 * 
	 * @param FilePath
	 * @return
	 * @throws IOException
	 */
	public static byte[] loadFileFromSysPath(String filePath) {
		byte[] fileContent = null;
		fileContent = loadFile(new File(filePath));
		return fileContent;
	}<commit_msg>增加取文件大小的函数<commit_after>package org.voovan.tools;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;

import org.voovan.tools.log.Logger;

/**
 * 文件操作工具类
 * 
 * @author helyho
 *
 * Voovan Framework.
 * WebSite: https://github.com/helyho/Voovan
 * Licence: Apache v2 License
 */
public class TFile {
	
	/**
	 * 路径拼装
	 * @param pathParts 每个由路劲分割符分割的路径字符串
	 * @return
	 */
	public static String assemblyPath(String ...pathParts ){
		String result = "";
		for(String pathPart : pathParts){
			result = result+pathPart+File.separator;
		}
		
		return TString.removeSuffix(result);
	}
	
	/**
	 * 获取文件大小
	 * @param file
	 * @return
	 * @throws FileNotFoundException
	 * @throws IOException
	 */
	public static int getFileSize(String filePath) {
		try {
			FileInputStream fileInputStream = new FileInputStream(new File( filePath));
			int fileSize = (fileInputStream).available();
			fileInputStream.close();
			return fileSize;
		} catch (Exception e) {
			Logger.error(e);
			return -1;
		}
		
	}
	
	/**
	 * 从系统路径读取文件内容
	 * 
	 * @param FilePath
	 * @return
	 * @throws IOException
	 */
	public static byte[] loadFileFromSysPath(String filePath) {
		byte[] fileContent = null;
		fileContent = loadFile(new File(filePath));
		return fileContent;
	}
{'fraction_non_alphanumeric': 0.12020033388981637, 'fraction_numerical': 0.0012520868113522537, 'mean_word_length': 3.7749003984063747, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2354612', 'n_tokens_mistral': 908, 'n_tokens_neox': 853, 'n_words': 172}