Merge branch 'script_gj' into 'master'
Script gj See merge request !1086
This commit is contained in:
@@ -104,6 +104,43 @@ class FileUtils {
|
|||||||
sb.setLength(0)
|
sb.setLength(0)
|
||||||
}
|
}
|
||||||
out.close();
|
out.close();
|
||||||
|
return sb.toString().getBytes(charset)
|
||||||
|
}
|
||||||
|
|
||||||
|
static def createEncryptFile(fileName, outputStr, isAppend){
|
||||||
|
OutputStream out = new FileOutputStream(fileName, isAppend);
|
||||||
|
out.write(outputStr.getBytes("utf-8"));
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static def createFileStringByCustomSuffix(ret, fileName, charset, suffix, lineSuffix){
|
||||||
|
File file = new File(fileName);
|
||||||
|
// if (file.exists()) {
|
||||||
|
// file.delete();
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (!file.getParentFile().exists()) {
|
||||||
|
boolean result = file.getParentFile().mkdirs();
|
||||||
|
if (!result) {
|
||||||
|
System.out.println("´´½¨Ä¿Â¼Ê§°Ü");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def sb = new StringBuffer();
|
||||||
|
def index = 0
|
||||||
|
for(def row : ret){
|
||||||
|
if(row){
|
||||||
|
index++
|
||||||
|
sb.append(StringUtils.join(row.toArray(), suffix))
|
||||||
|
if(index<ret.size()){
|
||||||
|
sb.append(lineSuffix+"\n");
|
||||||
|
}else{
|
||||||
|
sb.append(lineSuffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user