yangys
2025-09-25 31ecdb8c700529a59dd762f0c47f0ed9c66d5092
blade-service/blade-mdm/src/main/java/org/springblade/mdm/utils/FileContentUtil.java
@@ -190,4 +190,20 @@
      }
      return new ByteArrayInputStream(Files.newInputStream(tempFile).readAllBytes());
    }
   public static List<String> readFirstNLines(InputStream inputStream, int n) throws IOException {
      List<String> lines = new ArrayList<>();
      try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
         String line;
         int count = 0;
         while ((line = reader.readLine()) != null && count < n) {
            lines.add(line);
            count++;
         }
      }
      return lines;
   }
}