save
@@ -89,29 +89,8 @@ | ||
89 | 89 | attrInfo.setFileSha256(BlancoFileManagerFileDigestUtil.getSHA256(file)); |
90 | 90 | |
91 | 91 | // StepCounter |
92 | - { | |
93 | - String fileName = file.getName(); | |
94 | - // ファイル名について、Amateras StepCounter が認識しやすくなるように一部加工します。 | |
95 | - if (fileName.endsWith(".xhtml")) { | |
96 | - // XHTML については XML と読み替えます。 | |
97 | - fileName = "dummy.xml"; | |
98 | - } | |
99 | - final StepCounter counter = StepCounterFactory.getCounter(fileName); | |
100 | - if (counter != null) { | |
101 | - // カウンターが取得できた場合にのみ処理します。 | |
102 | - // FIXME: 文字コードですが、さしあたり UTF-8 想定としています。 | |
103 | - final CountResult cntResult = counter.count(file, "UTF-8"); | |
92 | + analyzeWithStepCounter(file, fileInfo, attrInfo); | |
104 | 93 | |
105 | - fileInfo.setFileType(cntResult.getFileType()); | |
106 | - | |
107 | - // 注意: long を int に丸めています。int | |
108 | - // を超えるステップ数のファイル、というのは、想像しがたいです、、、。 | |
109 | - attrInfo.setValidLineCount((int) cntResult.getStep()); | |
110 | - attrInfo.setCommentLineCount((int) cntResult.getComment()); | |
111 | - attrInfo.setBlankLineCount((int) cntResult.getNon()); | |
112 | - } | |
113 | - } | |
114 | - | |
115 | 94 | // コールバックを呼び出します。 |
116 | 95 | fireFileInfo(fileInfo); |
117 | 96 | } catch (IOException ex) { |
@@ -118,4 +97,29 @@ | ||
118 | 97 | ex.printStackTrace(); |
119 | 98 | } |
120 | 99 | } |
100 | + | |
101 | + public static void analyzeWithStepCounter(final File file, final BlancoFileManagerFileInfo fileInfo, | |
102 | + final BlancoFileManagerFileAttrInfo attrInfo) throws IOException { | |
103 | + String fileName = file.getName(); | |
104 | + // ファイル名について、Amateras StepCounter が認識しやすくなるように一部加工します。 | |
105 | + if (fileName.endsWith(".xhtml")) { | |
106 | + // XHTML については XML と読み替えます。 | |
107 | + fileName = "dummy.xml"; | |
108 | + } | |
109 | + | |
110 | + final StepCounter counter = StepCounterFactory.getCounter(fileName); | |
111 | + if (counter != null) { | |
112 | + // カウンターが取得できた場合にのみ処理します。 | |
113 | + // FIXME: 文字コードですが、さしあたり UTF-8 想定としています。 | |
114 | + final CountResult cntResult = counter.count(file, "UTF-8"); | |
115 | + | |
116 | + fileInfo.setFileType(cntResult.getFileType()); | |
117 | + | |
118 | + // 注意: long を int に丸めています。int | |
119 | + // を超えるステップ数のファイル、というのは、想像しがたいです、、、。 | |
120 | + attrInfo.setValidLineCount((int) cntResult.getStep()); | |
121 | + attrInfo.setCommentLineCount((int) cntResult.getComment()); | |
122 | + attrInfo.setBlankLineCount((int) cntResult.getNon()); | |
123 | + } | |
124 | + } | |
121 | 125 | } |