Created
April 15, 2020 13:32
-
-
Save ignaciolg/5977b73e6f61bf33f68a9558403737cb to your computer and use it in GitHub Desktop.
Nashorn - Jmeter - Read file
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
var readEnvConfiguration = function (name) { | |
var olinkfile = name || 'default'; | |
var data = ""; | |
var chunk; | |
var FileReader = Java.type("java.io.FileReader"); | |
var fr = new FileReader(olinkfile); | |
var config; | |
chunk = fr.read(); | |
while (chunk != -1) { | |
data += String.fromCharCode(chunk); | |
chunk = fr.read(); | |
} | |
fr.close(); | |
config = JSON.parse(data); | |
log.info('?????????????????? ' + olinkfile + ' ?????????????????? ' + data + ' ????????????????????????????????????') | |
return config; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment