All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.litongjava.utils.file.FilesUtil Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package com.litongjava.utils.file;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

/**
 * @author 李通
 * @date 2019年1月8日_下午2:47:44 
 * @version 1.0 
 */
public class FilesUtil {
  public String readFile(String filepath) {
    StringBuffer stringBuffer = new StringBuffer();
    List readAllLines = null;
    try {
      readAllLines = Files.readAllLines(Paths.get(filepath));
    } catch (IOException e) {
      e.printStackTrace();
    }
    for (String string : readAllLines) {
      stringBuffer.append(string);
    }
    return stringBuffer.toString();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy