Last active
July 20, 2019 17:12
-
-
Save hrj/f9c182f5a57cbc67b90d to your computer and use it in GitHub Desktop.
DBF Show
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.iryndin.jdbf.reader.* | |
import net.iryndin.jdbf.core.* | |
val fis = java.io.FileInputStream(args[0]) | |
val reader = DbfReader(fis) | |
val md = reader.getMetadata() | |
val fields = md.getFields() | |
fields.forEach{f -> | |
val fieldType = f.getType() | |
val length = | |
if(fieldType == DbfFieldTypeEnum.Numeric) { | |
"%10s.%-10s".format(f.getLength(), f.getNumberOfDecimalPlaces()) | |
} else { | |
"%10s".format(f.getLength()) | |
} | |
println("%-20s %10s %s".format(f.getName(), fieldType, length)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's been a long time, but I guess adding
jdbf.jar
to the class path would have done that. That's what the-cp
argument is doing.