/** @deprecated unclear closing policy, do not use (to remove in IDEA 14) */
 @SuppressWarnings("UnusedDeclaration")
 public static List<String> loadLines(@NotNull Reader reader) throws IOException {
   BufferedReader bufferedReader = new BufferedReader(reader);
   try {
     return loadLines(bufferedReader);
   } finally {
     bufferedReader.close();
   }
 }
Exemplo n.º 2
0
 @NotNull
 public static List<String> loadLines(@NotNull Reader reader) throws IOException {
   List<String> lines = new ArrayList<String>();
   BufferedReader bufferedReader = new BufferedReader(reader);
   try {
     String line;
     while ((line = bufferedReader.readLine()) != null) {
       lines.add(line);
     }
   } finally {
     bufferedReader.close();
   }
   return lines;
 }
  @Nullable
  private static String getContent(File file) {
    try {
      StringBuilder content = new StringBuilder();
      BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
      try {
        do {
          String line = reader.readLine();
          if (line == null) break;
          content.append(line);
          content.append('\n');
        } while (true);
      } finally {
        reader.close();
      }

      return content.toString();
    } catch (Exception e) {
      return null;
    }
  }