class FileUtils {

    public static String file2String(MultipartFile file) {
        StringBuilder strBuilder = new StringBuilder();

        try (InputStreamReader inputStreamReader = new InputStreamReader(file.getInputStream(), StandardCharsets.UTF_8)) {
            BufferedReader streamReader = new BufferedReader(inputStreamReader);
            String inputStr;

            while ((inputStr = streamReader.readLine()) != null) {
                strBuilder.append(inputStr);
            }

        } catch (IOException e) {
            logger.error("file convert to string failed: {}", file.getName());
        }

        return strBuilder.toString();
    }

}