private Reader open() throws IOException { if ("default".equals(config.getEncoding())) { return new FileReader(fileModel.getSourceFile()); } InputStream is = new FileInputStream(fileModel.getSourceFile()); try { return new InputStreamReader(is, config.getEncoding()); } catch (IOException ex) { CloseUtil.close(is); throw ex; } }
private void outputSummary() throws IOException { for (Map.Entry<String, LimitedType> e : limitedMap.entrySet()) { String type = e.getKey(); LimitedType t = e.getValue(); w.println( " <type type='" + type + "' number='" + t.number + "' suppressed='" + ((t.number <= config.getLimit()) ? 0 : t.number - config.getLimit()) + "'/>"); } }
private void createLimited() throws IOException { for (Map.Entry<String, TreeSet<Violation>> e : fileModel.getTypeMap().entrySet()) { String type = e.getKey(); Set<Violation> violations = e.getValue(); LimitedType limitedType = new LimitedType(); limitedType.number = violations.size(); int c = 0; for (Violation v : violations) { limitedType.violations.add(v); addToVMap(v); doViolation(v); c++; if (c >= config.getLimit()) { break; } } limitedMap.put(type, limitedType); } }