class FileInfo { def file def isText def lineCount def realLineCount def FileInfo(file) { this.file = file this.isText = CodeCounter.TEXT_EXTENSIONS.contains(extension) if (isText) { def lines = file.readLines() this.lineCount = lines.size() this.realLineCount = lines.sum(0, { it.trim().length() == 0 ? 0 : 1 }) } } def getExtension() { name.substring(name.lastIndexOf(".") + 1) } def getName() { file.name } def getPath() { file.canonicalPath } def getByteCount() { file.length() } }