...
|
...
|
@@ -276,7 +276,8 @@ public class ShowSer { |
|
|
* @param flag --true ,当前行号写入文件 false --当前行 移出文件
|
|
|
*/
|
|
|
|
|
|
public boolean modifyFile(File file, int content, boolean flag) {
|
|
|
|
|
|
public synchronized boolean modifyFile(File file, int content, boolean flag) {
|
|
|
if(flag){
|
|
|
try {//追加写入文件
|
|
|
FileUtils.writeLines(file,"utf-8",Arrays.asList(content), true);
|
...
|
...
|
@@ -284,7 +285,8 @@ public class ShowSer { |
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
}/*else {//从文件中移出
|
|
|
};
|
|
|
/*else {//从文件中移出
|
|
|
LineIterator lineIterator = null;
|
|
|
try {
|
|
|
lineIterator = FileUtils.lineIterator(file);
|
...
|
...
|
@@ -303,4 +305,37 @@ public class ShowSer { |
|
|
}*/
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public synchronized boolean modifyFile(File file, String contentListStr, boolean flag) {
|
|
|
if(flag){
|
|
|
try {//追加写入文件
|
|
|
String[] strings = StringUtils.split(contentListStr, ",");
|
|
|
FileUtils.writeLines(file,"utf-8",Arrays.asList(strings), true);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
|
|
|
public boolean checkFile(File file){
|
|
|
if(!file.exists()){
|
|
|
try {
|
|
|
FileUtils.forceMkdirParent(file);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|