All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dbobjekts.codegen.writer.SourceFileWriter.kt Maven / Gradle / Ivy

There is a newer version: 0.6.0-RC2
Show newest version
package com.dbobjekts.codegen.writer

import com.dbobjekts.api.PackageName
import org.apache.commons.io.FileUtils
import java.io.File
import java.nio.charset.Charset

class SourceFileWriter(private val baseDir: String) {
    private val sep = File.separator

    fun write(source: String, packageName: PackageName, fileName: String) {
        val fileObj = File("${packagePath(packageName)}$sep$fileName")
        FileUtils.writeStringToFile(fileObj, source, Charset.defaultCharset())
    }

    fun packagePath(packageName: PackageName): String {
        val sep = File.separator
        val packagePath = packageName.asFilePath()
        return "$baseDir$sep$packagePath"
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy