FileStat.java 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package J20250804.demo01;
  2. /**
  3. * @author WanJl
  4. * @version 1.0
  5. * @title FileStat
  6. * @description 封装文件统计信息(文件名、字符数、行数)
  7. * @create 2025/8/4
  8. */
  9. public class FileStat {
  10. private String fileName;
  11. private Integer charCount;
  12. private Integer lineCount;
  13. public FileStat() {
  14. }
  15. public FileStat(String fileName, Integer charCount, Integer lineCount) {
  16. this.fileName = fileName;
  17. this.charCount = charCount;
  18. this.lineCount = lineCount;
  19. }
  20. public String getFileName() {
  21. return fileName;
  22. }
  23. public void setFileName(String fileName) {
  24. this.fileName = fileName;
  25. }
  26. public Integer getCharCount() {
  27. return charCount;
  28. }
  29. public void setCharCount(Integer charCount) {
  30. this.charCount = charCount;
  31. }
  32. public Integer getLineCount() {
  33. return lineCount;
  34. }
  35. public void setLineCount(Integer lineCount) {
  36. this.lineCount = lineCount;
  37. }
  38. @Override
  39. public String toString() {
  40. return String.format("%s:字符数=%d,行数=%d",fileName,charCount,lineCount);
  41. }
  42. }