Index: /main/trunk/gli/src/org/greenstone/gatherer/gui/FormatConversionDialog.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/gui/FormatConversionDialog.java	(revision 29016)
+++ /main/trunk/gli/src/org/greenstone/gatherer/gui/FormatConversionDialog.java	(revision 29017)
@@ -7,4 +7,6 @@
 import org.greenstone.gatherer.cdm.CollectionConfigXMLReadWrite;
 import org.greenstone.gatherer.util.Codec;
+import org.greenstone.gatherer.util.InputStreamGobbler;
+import org.greenstone.gatherer.util.OutputStreamGobbler;
 import org.greenstone.gatherer.util.StaticStrings;
 import org.greenstone.gatherer.util.Utility;
@@ -370,19 +372,4 @@
 
 	return outputstr;
-    }
-
-
-    // http://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html
-    // http://stackoverflow.com/questions/481446/throws-exception-in-finally-blocks
-    private void closeResource(Closeable resourceHandle) {
-	try {
-	    if(resourceHandle != null) {
-		resourceHandle.close();
-		resourceHandle = null;
-	    }
-	} catch(Exception e) {
-	    System.err.println("Exception closing resource: " + e.getMessage());
-	    e.printStackTrace();
-	}
     }
 
@@ -946,91 +933,4 @@
     }
 
-    // http://www.javaworld.com/article/2071275/core-java/when-runtime-exec---won-t.html?page=2
-    class InputStreamGobbler extends Thread
-    {
-	InputStream is = null;
-	StringBuffer outputstr = new StringBuffer();
-	boolean split_newlines = false;
-	
-	
-	public InputStreamGobbler(InputStream is)
-	{
-	    this.is = is;
-	    split_newlines = false;
-	}
-
-	public InputStreamGobbler(InputStream is, boolean split_newlines)
-	{
-	    this.is = is;
-	    this.split_newlines = split_newlines;
-	}
-	
-	public void run()
-	{
-	    BufferedReader br = null;
-	    try	{
-		br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
-		String line=null;
-		while ( (line = br.readLine()) != null) {
-		    //System.out.println("@@@ GOT LINE: " + line);
-		    outputstr.append(line);
-		    if(split_newlines) {
-			outputstr.append("\n");
-		    }
-
-		}
-	    } catch (IOException ioe) {
-		ioe.printStackTrace();  
-	    } finally {
-		closeResource(br);
-	    }
-	}
-	
-	public String getOutput() { 
-	    return outputstr.toString(); // implicit toString() call anyway. //return outputstr; 
-	}
-    }
-    
-    class OutputStreamGobbler extends Thread
-    {
-	OutputStream os = null;
-	String inputstr = "";
-
-	public OutputStreamGobbler(OutputStream os, String inputstr)
-	{
-	    this.os = os;
-	    this.inputstr = inputstr;
-	}
-	
-	public void run()
-	{
-	    BufferedWriter osw = null;
-	    try	{
-		osw = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
-		//System.out.println("@@@ SENDING LINE: " + inputstr);
-		osw.write(inputstr, 0, inputstr.length());
-		osw.newLine();//osw.write("\n");
-		osw.flush();
-
-		// Don't explicitly send EOF when using StreamGobblers as below, 
-		// as the EOF char is echoed to output.
-		// Flushing the write handle and/or closing the resource seems 
-		// to already send EOF silently.
-
-		/*if(Utility.isWindows()) {
-		    osw.write("\032"); // octal for Ctrl-Z, EOF on Windows
-		} else { // EOF on Linux/Mac is Ctrl-D
-		    osw.write("\004"); // octal for Ctrl-D, see http://www.unix-manuals.com/refs/misc/ascii-table.html
-		}
-		osw.flush();
-		*/
-	    } catch (IOException ioe) {
-		ioe.printStackTrace();  
-	    } finally {
-		closeResource(osw);
-	    }
-	}	
-    }
-
     private class UndoListener implements ActionListener
     {	
Index: /main/trunk/gli/src/org/greenstone/gatherer/util/InputStreamGobbler.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/util/InputStreamGobbler.java	(revision 29017)
+++ /main/trunk/gli/src/org/greenstone/gatherer/util/InputStreamGobbler.java	(revision 29017)
@@ -0,0 +1,57 @@
+package org.greenstone.gatherer.util;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+
+// http://www.javaworld.com/article/2071275/core-java/when-runtime-exec---won-t.html?page=2
+// This class is used in FormatConversionDialog to properly read from the output and error streams of a Process
+public class InputStreamGobbler extends Thread
+{
+    InputStream is = null;
+    StringBuffer outputstr = new StringBuffer();
+    boolean split_newlines = false;
+    
+    
+    public InputStreamGobbler(InputStream is)
+    {
+	this.is = is;
+	split_newlines = false;
+    }
+    
+    public InputStreamGobbler(InputStream is, boolean split_newlines)
+    {
+	this.is = is;
+	this.split_newlines = split_newlines;
+    }
+    
+    public void run()
+    {
+	BufferedReader br = null;
+	try {
+	    br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+	    String line=null;
+	    while ( (line = br.readLine()) != null) {
+		//System.out.println("@@@ GOT LINE: " + line);
+		outputstr.append(line);
+		if(split_newlines) {
+		    outputstr.append("\n");
+		}
+		
+	    }
+	} catch (IOException ioe) {
+	    ioe.printStackTrace();  
+	} finally {
+	    Utility.closeResource(br);
+	}
+    }
+    
+    public String getOutput() { 
+	return outputstr.toString(); // implicit toString() call anyway. //return outputstr; 
+    }
+}
Index: /main/trunk/gli/src/org/greenstone/gatherer/util/OutputStreamGobbler.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/util/OutputStreamGobbler.java	(revision 29017)
+++ /main/trunk/gli/src/org/greenstone/gatherer/util/OutputStreamGobbler.java	(revision 29017)
@@ -0,0 +1,53 @@
+package org.greenstone.gatherer.util;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+
+// http://www.javaworld.com/article/2071275/core-java/when-runtime-exec---won-t.html?page=2
+// This class is used in FormatConversionDialog to properly write to the inputstream of a Process
+public class OutputStreamGobbler extends Thread
+{
+    OutputStream os = null;
+    String inputstr = "";
+    
+    public OutputStreamGobbler(OutputStream os, String inputstr)
+    {
+	this.os = os;
+	this.inputstr = inputstr;
+    }
+    
+    public void run()
+    {
+	BufferedWriter osw = null;
+	try	{
+	    osw = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
+	    //System.out.println("@@@ SENDING LINE: " + inputstr);
+	    osw.write(inputstr, 0, inputstr.length());
+	    osw.newLine();//osw.write("\n");
+	    osw.flush();
+	    
+	    // Don't explicitly send EOF when using StreamGobblers as below, 
+	    // as the EOF char is echoed to output.
+	    // Flushing the write handle and/or closing the resource seems 
+	    // to already send EOF silently.
+	    
+	    /*if(Utility.isWindows()) {
+	      osw.write("\032"); // octal for Ctrl-Z, EOF on Windows
+	      } else { // EOF on Linux/Mac is Ctrl-D
+	      osw.write("\004"); // octal for Ctrl-D, see http://www.unix-manuals.com/refs/misc/ascii-table.html
+	      }
+	      osw.flush();
+	    */
+	} catch (IOException ioe) {
+	    ioe.printStackTrace();  
+	} finally {
+	    Utility.closeResource(osw);
+	}
+    }	
+}
Index: /main/trunk/gli/src/org/greenstone/gatherer/util/Utility.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/util/Utility.java	(revision 29016)
+++ /main/trunk/gli/src/org/greenstone/gatherer/util/Utility.java	(revision 29017)
@@ -41,4 +41,5 @@
 // Don't even think about adding import java.awt.* here!
 // The functions in this class should not use any graphical classes. Put your function somewhere else buster!
+import java.io.Closeable;
 import java.io.*;
 import java.net.*;
@@ -556,3 +557,19 @@
 		return oldValue;
     }
+
+    // For safely closing streams/handles/resources. 
+    // For examples of use look in the Input- and OutputStreamGobbler classes.
+    // http://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html
+    // http://stackoverflow.com/questions/481446/throws-exception-in-finally-blocks
+    public static void closeResource(Closeable resourceHandle) {
+	try {
+	    if(resourceHandle != null) {
+		resourceHandle.close();
+		resourceHandle = null;
+	    }
+	} catch(Exception e) {
+	    System.err.println("Exception closing resource: " + e.getMessage());
+	    e.printStackTrace();
+	}
+    }
 }
