// Path: kbox.core/src/main/java/org/aksw/kbox/utils/StreamUtils.java
// public class StreamUtils {
// 	public static void stream(InputStream inputStream, File destFile) throws FileNotFoundException, IOException {
// 		ReadableByteChannel rbc = Channels.newChannel(inputStream);
// 		try (FileOutputStream fos = new FileOutputStream(destFile)) {
// 			fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
// 		}
// 	}
// }


import java.io.File;
import java.io.InputStream;
import org.aksw.kbox.utils.StreamUtils;
package org.aksw.kbox;



/**
 * Default install implementation for files.
 * 
 * @author {@linkplain http://emarx.org}
 *
 */
public class ResourceInstall extends AbstractInstall {

	public ResourceInstall() {
		super(new ResourcePathBinder());
	}	

	public void stream(InputStream inputStream, File dest) throws Exception {
		File resourceDir = dest.getParentFile();
		resourceDir.mkdirs();
		dest.createNewFile();
// Path: kbox.core/src/main/java/org/aksw/kbox/utils/StreamUtils.java
// public class StreamUtils {
// 	public static void stream(InputStream inputStream, File destFile) throws FileNotFoundException, IOException {
// 		ReadableByteChannel rbc = Channels.newChannel(inputStream);
// 		try (FileOutputStream fos = new FileOutputStream(destFile)) {
// 			fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
// 		}
// 	}
// }


// Path: kbox.core/src/main/java/org/aksw/kbox/ResourceInstall.java
import java.io.File;
import java.io.InputStream;
import org.aksw.kbox.utils.StreamUtils;

package org.aksw.kbox;



/**
 * Default install implementation for files.
 * 
 * @author {@linkplain http://emarx.org}
 *
 */
public class ResourceInstall extends AbstractInstall {

	public ResourceInstall() {
		super(new ResourcePathBinder());
	}	

	public void stream(InputStream inputStream, File dest) throws Exception {
		File resourceDir = dest.getParentFile();
		resourceDir.mkdirs();
		dest.createNewFile();
		StreamUtils.stream(inputStream, dest);