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

com.danielsomerfield.util.io.FilePathOutputStreamFactory.groovy Maven / Gradle / Ivy

There is a newer version: 0.6.2-100
Show newest version
package com.danielsomerfield.util.io

import org.slf4j.Logger
import org.slf4j.LoggerFactory

class FilePathOutputStreamFactory implements OutputStreamFactory {

  private final String path;
  private Logger logger = LoggerFactory.getLogger(getClass())

  public FilePathOutputStreamFactory(final String path) {
    this.path = path;
    new File(path).getParentFile().mkdirs()
  }

  @Override
  public OutputStream getOutputStream() {
    logger.debug("getOutputStream: path = $path")
    return new FileOutputStream(path)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy