// Path: src/main/java/com/jenkov/iap/error/IapToolsException.java
// public class IapToolsException extends RuntimeException {
// 
//     public IapToolsException() {
//         super();
//     }
// 
//     public IapToolsException(String message) {
//         super(message);
//     }
// 
//     public IapToolsException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public IapToolsException(Throwable cause) {
//         super(cause);
//     }
// 
//     protected IapToolsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }


import com.jenkov.iap.error.IapToolsException;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.Date;
            rollLogFile();
        }
    }


    private void rollLogFile() throws IOException {

        //close current log file
        if(this.output != null){
            this.output.flush();
            this.output.close();
        }

        this.currentLogFileSize      = 0;

        StringBuilder newLogFileNameBuilder = new StringBuilder(); //todo reuse a StringBuilder instead - clear it.

        newLogFileNameBuilder.append(this.logFileBaseName);
        newLogFileNameBuilder.append('.');
        newLogFileNameBuilder.append(this.dateFormat.format(new Date(this.currentLogFileTimeInterval)));
        newLogFileNameBuilder.append('.');
        newLogFileNameBuilder.append(String.valueOf(this.currentLogFileNumber));
        newLogFileNameBuilder.append(".wlog");

        String newLogFileName = newLogFileNameBuilder.toString();

        //todo keep this.logFileDir as a String instead? Less string creation
        Path newLogFilePath = Paths.get(this.logFileDir.toString(), newLogFileName);

        //this.dataOutput = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(newLogFilePath.toFile()), BUFFERED_OUTPUT_STREAM_BUFFER_SIZE));
// Path: src/main/java/com/jenkov/iap/error/IapToolsException.java
// public class IapToolsException extends RuntimeException {
// 
//     public IapToolsException() {
//         super();
//     }
// 
//     public IapToolsException(String message) {
//         super(message);
//     }
// 
//     public IapToolsException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public IapToolsException(Throwable cause) {
//         super(cause);
//     }
// 
//     protected IapToolsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }


// Path: src/main/java/com/jenkov/iap/file/FileWriter.java
import com.jenkov.iap.error.IapToolsException;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.Date;

            rollLogFile();
        }
    }


    private void rollLogFile() throws IOException {

        //close current log file
        if(this.output != null){
            this.output.flush();
            this.output.close();
        }

        this.currentLogFileSize      = 0;

        StringBuilder newLogFileNameBuilder = new StringBuilder(); //todo reuse a StringBuilder instead - clear it.

        newLogFileNameBuilder.append(this.logFileBaseName);
        newLogFileNameBuilder.append('.');
        newLogFileNameBuilder.append(this.dateFormat.format(new Date(this.currentLogFileTimeInterval)));
        newLogFileNameBuilder.append('.');
        newLogFileNameBuilder.append(String.valueOf(this.currentLogFileNumber));
        newLogFileNameBuilder.append(".wlog");

        String newLogFileName = newLogFileNameBuilder.toString();

        //todo keep this.logFileDir as a String instead? Less string creation
        Path newLogFilePath = Paths.get(this.logFileDir.toString(), newLogFileName);

        //this.dataOutput = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(newLogFilePath.toFile()), BUFFERED_OUTPUT_STREAM_BUFFER_SIZE));
        this.output = new BufferedOutputStream(new FileOutputStream(newLogFilePath.toFile()), BUFFERED_OUTPUT_STREAM_BUFFER_SIZE);