// Path: org/knapsack/shell/StringConstants.java
// public final class StringConstants {
// 
// 	/**
// 	 * The system character or characters to signify a new line.
// 	 */
// 	public static final String CRLF = System.getProperty("line.separator");
// 	
// 	/**
// 	 * Character for tab.
// 	 */
// 	public static final String TAB = " \t";
// 
// 
// 
// }


import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.URISyntaxException;
import java.util.Arrays;
import org.knapsack.shell.StringConstants;
import org.osgi.service.log.LogService;

		if (istream == null)
			throw new IOException("Jar resource is not present: " + resourceFilename);
		
		FileOutputStream fos = new FileOutputStream(outFile);
		
		copy(istream, fos);
		closeQuietly(fos);
		
		return true;
	}

	/**
	 * Copy shell scripts from the Jar into the deployment directory.
	 * @param scriptDir
	 * @param shellPort
	 * @param command
	 * @throws IOException
	 * @throws URISyntaxException
	 */
	public static void copyScripts(File scriptDir, int shellPort, String command) throws IOException, URISyntaxException {
		if (!scriptDir.exists())
			if (!scriptDir.mkdirs())
				throw new IOException("Unable to create directories: " + scriptDir);

		File baseScriptFile = new File(scriptDir, ConfigurationConstants.BASE_SCRIPT_FILENAME);

		if (!baseScriptFile.exists()) {
			StringBuilder sb = new StringBuilder();
			sb.append("#!/bin/sh");
// Path: org/knapsack/shell/StringConstants.java
// public final class StringConstants {
// 
// 	/**
// 	 * The system character or characters to signify a new line.
// 	 */
// 	public static final String CRLF = System.getProperty("line.separator");
// 	
// 	/**
// 	 * Character for tab.
// 	 */
// 	public static final String TAB = " \t";
// 
// 
// 
// }


// Path: org/knapsack/FSHelper.java
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.URISyntaxException;
import java.util.Arrays;
import org.knapsack.shell.StringConstants;
import org.osgi.service.log.LogService;


		if (istream == null)
			throw new IOException("Jar resource is not present: " + resourceFilename);
		
		FileOutputStream fos = new FileOutputStream(outFile);
		
		copy(istream, fos);
		closeQuietly(fos);
		
		return true;
	}

	/**
	 * Copy shell scripts from the Jar into the deployment directory.
	 * @param scriptDir
	 * @param shellPort
	 * @param command
	 * @throws IOException
	 * @throws URISyntaxException
	 */
	public static void copyScripts(File scriptDir, int shellPort, String command) throws IOException, URISyntaxException {
		if (!scriptDir.exists())
			if (!scriptDir.mkdirs())
				throw new IOException("Unable to create directories: " + scriptDir);

		File baseScriptFile = new File(scriptDir, ConfigurationConstants.BASE_SCRIPT_FILENAME);

		if (!baseScriptFile.exists()) {
			StringBuilder sb = new StringBuilder();
			sb.append("#!/bin/sh");
			sb.append(StringConstants.CRLF);