
com.chimpcentral.simpleLogger.FlatFile Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of logger Show documentation
Show all versions of logger Show documentation
Logger to create HTML and TEXT logs
package com.chimpcentral.simpleLogger;
import java.io.IOException;
import com.chimpcentral.io.FileStatus;
public class FlatFile extends com.chimpcentral.io.FlatFile {
public FlatFile(String filepath, FileStatus fileStatus) throws IOException {
super(filepath, fileStatus);
}
public FlatFile appendContent(String content) {
try {
super.appendContent(content);
} catch (IOException e) {
e.printStackTrace();
}
return this;
}
public String getContent() {
try {
return super.getContent();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public FlatFile replaceContent(String oldString, String newString) {
String existingContent = getContent();
this.clearContent();
this.appendContent(existingContent.replace(oldString, newString));
return this;
}
public FlatFile clearContent() {
try {
super.clearContent();
} catch (IOException e) {
e.printStackTrace();
}
return this;
}
// public static void main(String[] args) {
// String value = "khurram waleed bhatti is going to build this log file and it is going to be fun";
//
// int startIndex = value.indexOf("");
// int endIndex = value.indexOf("");
// String stringToReplace = value.substring(startIndex, endIndex) + "";
// String newValue = value.replace(stringToReplace, "is a genius and have fun with");
// System.out.println(newValue);
//
//
//
// }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy