kr.jm.utils.flow.subscriber.JMFileSubscriber Maven / Gradle / Ivy
package kr.jm.utils.flow.subscriber;
import kr.jm.utils.JMFileAppender;
import kr.jm.utils.helper.JMJson;
import kr.jm.utils.helper.JMStream;
import java.nio.file.Path;
import java.util.function.Function;
/**
* The type Jm file subscriber.
*
* @param the type parameter
*/
public class JMFileSubscriber extends JMSubscriber implements
AutoCloseable {
private JMFileAppender fileAppender;
/**
* Instantiates a new Jm file subscriber.
*
* @param filePath the file path
*/
public JMFileSubscriber(String filePath) {
this(filePath, false);
}
/**
* Instantiates a new Jm file subscriber.
*
* @param filePath the file path
* @param enableJsonString the enable json string
*/
public JMFileSubscriber(String filePath, boolean enableJsonString) {
this(filePath,
enableJsonString ? JMJson::toJsonString : Object::toString);
}
/**
* Instantiates a new Jm file subscriber.
*
* @param filePath the file path
* @param toStringFunction the to string function
*/
public JMFileSubscriber(String filePath,
Function