<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>core/behaviour/src/net/sf/cotta/io/InputTest.java</filename>
    </added>
    <added>
      <filename>core/behaviour/src/net/sf/cotta/io/OutputTest.java</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,13 +1,11 @@
 package net.sf.cotta.io;
 
-import net.sf.cotta.TIoException;
 import net.sf.cotta.TestCase;
 import org.jmock.Expectations;
 import org.jmock.Mockery;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.OutputStream;
 
 public class OutputManagerTest extends TestCase {
   public Mockery context = new Mockery();
@@ -48,27 +46,4 @@ public class OutputManagerTest extends TestCase {
     });
     context.assertIsSatisfied();
   }
-
-  public void testWithStaticFactoryMethod() throws TIoException {
-    final OutputStream stream = new ByteArrayOutputStream();
-    OutputManager.with(stream).write(new OutputProcessor() {
-      public void process(OutputManager manager) throws IOException {
-        ensure.that(manager.outputStream()).sameAs(stream);
-      }
-    });
-  }
-
-  public void testWithStaticFactorySupportsPath() throws TIoException {
-    OutputStream stream = new ByteArrayOutputStream();
-    OutputManager.with(stream).write(new OutputProcessor() {
-      public void process(OutputManager manager) throws IOException {
-        try {
-          manager.writer(&quot;aoeuaoeuaoeu&quot;);
-          fail(&quot;should have thrown exception for wrong encoding&quot;);
-        } catch (TIoException e) {
-          ensure.that(e).message().contains(&quot;output stream&quot;);
-        }
-      }
-    });
-  }
 }</diff>
      <filename>core/behaviour/src/net/sf/cotta/io/OutputManagerTest.java</filename>
    </modified>
    <modified>
      <diff>@@ -36,7 +36,7 @@ public class ProductInfoTest extends TestCase {
     ensure.that(productInfo.title()).eq(&quot;Cotta&quot;);
     ensure.that(productInfo.vendor()).eq(&quot;SourceForge Cotta&quot;);
     ensure.that(productInfo.url()).eq(&quot;http://cotta.sourceforge.net&quot;);
-    ensure.that(productInfo.version().value()).eq(&quot;2.0.0&quot;);
+    ensure.that(productInfo.version().value()).eq(&quot;2.1.0&quot;);
     ensure.that(productInfo.version().build()).notNull();
   }
 </diff>
      <filename>core/behaviour/src/net/sf/cotta/utils/ProductInfoTest.java</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 Implementation-Title: Cotta
-Implementation-Version: 2.0.0
+Implementation-Version: 2.1.0
 Implementation-Build: 79
 Implementation-Vendor: SourceForge Cotta
 Implementation-Vendor-Id: net.sf.cotta</diff>
      <filename>core/src/META-INF/MANIFEST.MF</filename>
    </modified>
    <modified>
      <diff>@@ -41,8 +41,7 @@ public class TDirectoryListing implements Iterable&lt;TEntry&gt; {
     return list;
   }
 
-  @SuppressWarnings({&quot;unchecked&quot;})
-  private void addFiles(ArrayList entries, List&lt;TPath&gt; files) {
+  private void addFiles(ArrayList&lt;? super TFile&gt; entries, List&lt;TPath&gt; files) {
     for (TPath path : files) {
       TFile file = factory.file(path);
       if (fileFilter.accept(file)) {
@@ -51,8 +50,7 @@ public class TDirectoryListing implements Iterable&lt;TEntry&gt; {
     }
   }
 
-  @SuppressWarnings({&quot;unchecked&quot;})
-  private void addDirs(ArrayList entries, List&lt;TPath&gt; dirs) {
+  private void addDirs(ArrayList&lt;? super TDirectory&gt; entries, List&lt;TPath&gt; dirs) {
     for (TPath path : dirs) {
       TDirectory dir = factory.dir(path);
       if (directoryFilter.accept(dir)) {</diff>
      <filename>core/src/net/sf/cotta/TDirectoryListing.java</filename>
    </modified>
    <modified>
      <diff>@@ -118,7 +118,13 @@ public class TFile extends TEntry {
     };
   }
 
-  private FileChannel inputChannel() throws TIoException {
+  /**
+   * Creates the input channel for the file
+   *
+   * @return FileChannel for input
+   * @throws TIoException error in creating the input channel
+   */
+  public FileChannel inputChannel() throws TIoException {
     return filesystem().createInputChannel(path);
   }
 
@@ -237,7 +243,7 @@ public class TFile extends TEntry {
    * @throws TIoException error in reading the file
    */
   public void read(final InputProcessor processor) throws TIoException {
-    InputManager.with(inputStreamFactory()).read(processor);
+    Input.with(inputStreamFactory()).read(processor);
   }
 
   /**
@@ -247,15 +253,15 @@ public class TFile extends TEntry {
    * @throws TIoException error in reading the file
    */
   public void read(final LineProcessor lineProcessor) throws TIoException {
-    InputManager.with(inputStreamFactory()).readLines(lineProcessor);
+    Input.with(inputStreamFactory()).readLines(lineProcessor);
   }
 
   public void append(final OutputProcessor processor) throws TIoException {
-    OutputManager.with(outputStreamFactory(OutputMode.APPEND), null).write(processor);
+    Output.with(outputStreamFactory(OutputMode.APPEND), null).write(processor);
   }
 
   public void write(final OutputProcessor processor) throws TIoException {
-    OutputManager.with(outputStreamFactory(OutputMode.OVERWRITE), null).write(processor);
+    Output.with(outputStreamFactory(OutputMode.OVERWRITE), null).write(processor);
   }
 
   /**</diff>
      <filename>core/src/net/sf/cotta/TFile.java</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,16 @@
 package net.sf.cotta.io;
 
 import net.sf.cotta.TIoException;
+import net.sf.cotta.TPath;
 
 import java.io.BufferedReader;
 import java.io.IOException;
+import java.io.InputStream;
+import java.nio.channels.FileChannel;
 
+/**
+ * Input processing class used to expose the API in the right context
+ */
 public class Input {
   private InputManager manager;
 
@@ -40,4 +46,62 @@ public class Input {
       }
     });
   }
+
+  /**
+   * A static factory to create an Input instance for processing the input stream with system default encoding
+   *
+   * @param stream the input stream to process
+   * @return The Input instance
+   */
+  public static Input with(final InputStream stream) {
+    return with(stream, null);
+  }
+
+  /**
+   * A static factory to create an Input instance for processing the input stream with the given encoding when creating readers
+   *
+   * @param stream   the input stream to process
+   * @param encoding encoding used when creating readers
+   * @return The Input instance
+   */
+  public static Input with(final InputStream stream, String encoding) {
+    return with(new InputStreamFactory() {
+      public InputStream inputStream() throws TIoException {
+        return stream;
+      }
+
+      public FileChannel inputChannel() throws TIoException {
+        throw new UnsupportedOperationException();
+      }
+
+      public TPath path() {
+        return TPath.parse(&quot;/input stream&quot;);
+      }
+
+    }, encoding);
+  }
+
+  /**
+   * A static factory to create an Input instance for processing the input stream
+   * to be created by the InputStreamFactory with system default encoding
+   *
+   * @param streamFactory input stream factory
+   * @return the Input instance
+   */
+  public static Input with(InputStreamFactory streamFactory) {
+    return with(streamFactory, null);
+  }
+
+  /**
+   * A static factory to create an Input instance for processing the input stream
+   * to be created by the InputStreamFactory with provided encoding
+   *
+   * @param streamFactory input stream factory
+   * @param encoding      encoding used to create readers
+   * @return the Input instance
+   */
+  public static Input with(InputStreamFactory streamFactory, String encoding) {
+    final InputManager manager = new InputManager(streamFactory, encoding);
+    return new Input(manager);
+  }
 }</diff>
      <filename>core/src/net/sf/cotta/io/Input.java</filename>
    </modified>
    <modified>
      <diff>@@ -11,6 +11,10 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
 
+/**
+ * InputManager for input resource management.  This class is to be used
+ * through {@link net.sf.cotta.io.Input}
+ */
 public class InputManager extends ResourceManager&lt;InputProcessor&gt; {
   private InputFactory inputFactory;
 
@@ -70,17 +74,16 @@ public class InputManager extends ResourceManager&lt;InputProcessor&gt; {
    *
    * @param buffer the buffer to clean up
    */
+  @SuppressWarnings(&quot;unchecked&quot;)
   public void clean(final MappedByteBuffer buffer) {
     AccessController.doPrivileged(new PrivilegedAction() {
       public Object run() {
         try {
           Method getCleanerMethod = buffer.getClass
-              ().getMethod(&quot;cleaner&quot;,
-              new Class[0]);
+              ().getMethod(&quot;cleaner&quot;);
           getCleanerMethod.setAccessible(true);
           sun.misc.Cleaner cleaner =
-              (sun.misc.Cleaner) getCleanerMethod.invoke(buffer, new Object
-                  [0]);
+              (sun.misc.Cleaner) getCleanerMethod.invoke(buffer);
           cleaner.clean();
         } catch (Exception e) {
           e.printStackTrace();
@@ -95,9 +98,11 @@ public class InputManager extends ResourceManager&lt;InputProcessor&gt; {
    *
    * @param stream the input stream to process
    * @return The Input instance
+   * @deprecated Moved to Input
    */
+  @Deprecated
   public static Input with(final InputStream stream) {
-    return with(stream, null);
+    return Input.with(stream);
   }
 
   /**
@@ -106,22 +111,11 @@ public class InputManager extends ResourceManager&lt;InputProcessor&gt; {
    * @param stream   the input stream to process
    * @param encoding encoding used when creating readers
    * @return The Input instance
+   * @deprecated Moved to Input
    */
+  @Deprecated
   public static Input with(final InputStream stream, String encoding) {
-    return with(new InputStreamFactory() {
-      public InputStream inputStream() throws TIoException {
-        return stream;
-      }
-
-      public FileChannel inputChannel() throws TIoException {
-        throw new UnsupportedOperationException();
-      }
-
-      public TPath path() {
-        return TPath.parse(&quot;/input stream&quot;);
-      }
-
-    }, encoding);
+    return Input.with(stream, encoding);
   }
 
   /**
@@ -130,9 +124,11 @@ public class InputManager extends ResourceManager&lt;InputProcessor&gt; {
    *
    * @param streamFactory input stream factory
    * @return the Input instance
+   * @deprecated Moved to Input
    */
+  @Deprecated
   public static Input with(InputStreamFactory streamFactory) {
-    return with(streamFactory, null);
+    return Input.with(streamFactory);
   }
 
   /**
@@ -142,10 +138,11 @@ public class InputManager extends ResourceManager&lt;InputProcessor&gt; {
    * @param streamFactory input stream factory
    * @param encoding      encoding used to create readers
    * @return the Input instance
+   * @deprecated Moved to Input
    */
+  @Deprecated
   public static Input with(InputStreamFactory streamFactory, String encoding) {
-    final InputManager manager = new InputManager(streamFactory, encoding);
-    return new Input(manager);
+    return Input.with(streamFactory, encoding);
   }
 
 }</diff>
      <filename>core/src/net/sf/cotta/io/InputManager.java</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,9 @@
 package net.sf.cotta.io;
 
 import net.sf.cotta.TIoException;
+import net.sf.cotta.TPath;
+
+import java.io.OutputStream;
 
 public class Output {
   private OutputManager manager;
@@ -12,4 +15,54 @@ public class Output {
   public void write(OutputProcessor processor) throws TIoException {
     manager.open(processor);
   }
+
+  /**
+   * Creates the output instance with the given output stream and use system encoding
+   *
+   * @param stream output stream
+   * @return output instance
+   */
+  public static Output with(final OutputStream stream) {
+    return with(stream, null);
+  }
+
+  /**
+   * Create the output instance with the given output steram and default encoding
+   *
+   * @param stream          output stream
+   * @param defaultEncoding default encoding for creating the writers
+   * @return output instance
+   */
+  public static Output with(final OutputStream stream, String defaultEncoding) {
+    return with(new OutputStreamFactory() {
+      public TPath path() {
+        return TPath.parse(&quot;/output stream&quot;);
+      }
+
+      public OutputStream outputStream() throws TIoException {
+        return stream;
+      }
+    }, defaultEncoding);
+  }
+
+  /**
+   * Create the output instance with the stream factory and use system encoding
+   *
+   * @param streamFactory stream factory
+   * @return output instance
+   */
+  public static Output with(OutputStreamFactory streamFactory) {
+    return with(streamFactory, null);
+  }
+
+  /**
+   * Creates the output instance
+   *
+   * @param streamFactory   output stream factory
+   * @param defaultEncoding default encoding for the writers
+   * @return output instance
+   */
+  public static Output with(OutputStreamFactory streamFactory, String defaultEncoding) {
+    return new Output(new OutputManager(streamFactory, defaultEncoding));
+  }
 }</diff>
      <filename>core/src/net/sf/cotta/io/Output.java</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,9 @@ import net.sf.cotta.TPath;
 import java.io.*;
 import java.util.ArrayList;
 
+/**
+ * Output resource management class to be used through {@link net.sf.cotta.io.Output}
+ */
 public class OutputManager extends ResourceManager&lt;OutputProcessor&gt; {
   private OutputFactory output;
 
@@ -57,9 +60,11 @@ public class OutputManager extends ResourceManager&lt;OutputProcessor&gt; {
    *
    * @param stream output stream
    * @return output instance
+   * @deprecated moved to Output
    */
+  @Deprecated
   public static Output with(final OutputStream stream) {
-    return with(stream, null);
+    return Output.with(stream);
   }
 
   /**
@@ -68,17 +73,11 @@ public class OutputManager extends ResourceManager&lt;OutputProcessor&gt; {
    * @param stream          output stream
    * @param defaultEncoding default encoding for creating the writers
    * @return output instance
+   * @deprecated moved to Output
    */
+  @Deprecated
   public static Output with(final OutputStream stream, String defaultEncoding) {
-    return with(new OutputStreamFactory() {
-      public TPath path() {
-        return TPath.parse(&quot;/output stream&quot;);
-      }
-
-      public OutputStream outputStream() throws TIoException {
-        return stream;
-      }
-    }, defaultEncoding);
+    return Output.with(stream, defaultEncoding);
   }
 
   /**
@@ -86,9 +85,11 @@ public class OutputManager extends ResourceManager&lt;OutputProcessor&gt; {
    *
    * @param streamFactory stream factory
    * @return output instance
+   * @deprecated moved to Output
    */
+  @Deprecated
   public static Output with(OutputStreamFactory streamFactory) {
-    return with(streamFactory, null);
+    return Output.with(streamFactory);
   }
 
   /**
@@ -97,8 +98,10 @@ public class OutputManager extends ResourceManager&lt;OutputProcessor&gt; {
    * @param streamFactory   output stream factory
    * @param defaultEncoding default encoding for the writers
    * @return output instance
+   * @deprecated
    */
+  @Deprecated
   public static Output with(OutputStreamFactory streamFactory, String defaultEncoding) {
-    return new Output(new OutputManager(streamFactory, defaultEncoding));
+    return Output.with(streamFactory, defaultEncoding);
   }
 }</diff>
      <filename>core/src/net/sf/cotta/io/OutputManager.java</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,12 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+/**
+ * resource manager that handles the resource management.  This class is to
+ * be used through its sub-classes
+ *
+ * @param &lt;P&gt; The processor to be used for call back
+ */
 abstract public class ResourceManager&lt;P&gt; {
   private List&lt;Closeable&gt; resourceList;
 
@@ -24,7 +30,7 @@ abstract public class ResourceManager&lt;P&gt; {
     resourceList.add(resource);
   }
 
-  public void open(P processor) throws TIoException {
+  protected void open(P processor) throws TIoException {
     boolean errorOccurred = true;
     try {
       process(processor);</diff>
      <filename>core/src/net/sf/cotta/io/ResourceManager.java</filename>
    </modified>
    <modified>
      <diff>@@ -39,14 +39,21 @@ public class TestLoader {
     Class&lt;? extends TestCase&gt; testClass;
     try {
       Class&lt;?&gt; loadedClass = Class.forName(name);
-      //noinspection unchecked
-      testClass = (Class&lt;? extends TestCase&gt;) loadedClass;
+      testClass = checkAndCast(loadedClass);
     } catch (ClassNotFoundException e) {
       throw new RuntimeException(e.getMessage(), e);
     }
     return testClass;
   }
 
+  @SuppressWarnings({&quot;unchecked&quot;})
+  private Class&lt;? extends TestCase&gt; checkAndCast(Class&lt;?&gt; loadedClass) {
+    if (TestCase.class.isAssignableFrom(loadedClass)) {
+      return (Class&lt;TestCase&gt;) loadedClass;
+    }
+    throw new RuntimeException(loadedClass + &quot; is not a sub-class of TestCase&quot;);
+  }
+
   private ClassPathEntryProcessor collectNames() {
     return new ClassPathEntryProcessor() {
       public void process(TDirectory directory) throws TIoException {</diff>
      <filename>core/src/net/sf/cotta/test/TestLoader.java</filename>
    </modified>
    <modified>
      <diff>@@ -157,8 +157,8 @@
   &lt;component name=&quot;JavacSettings&quot;&gt;
     &lt;option name=&quot;DEBUGGING_INFO&quot; value=&quot;true&quot; /&gt;
     &lt;option name=&quot;GENERATE_NO_WARNINGS&quot; value=&quot;false&quot; /&gt;
-    &lt;option name=&quot;DEPRECATION&quot; value=&quot;true&quot; /&gt;
-    &lt;option name=&quot;ADDITIONAL_OPTIONS_STRING&quot; value=&quot;&quot; /&gt;
+    &lt;option name=&quot;DEPRECATION&quot; value=&quot;false&quot; /&gt;
+    &lt;option name=&quot;ADDITIONAL_OPTIONS_STRING&quot; value=&quot;-Xlint:unchecked&quot; /&gt;
     &lt;option name=&quot;MAXIMUM_HEAP_SIZE&quot; value=&quot;128&quot; /&gt;
   &lt;/component&gt;
   &lt;component name=&quot;JavadocGenerationManager&quot;&gt;</diff>
      <filename>cotta.ipr</filename>
    </modified>
    <modified>
      <diff>@@ -105,7 +105,7 @@ public class TestFtpServerFileSystem implements FileSystem {
 
   public ReadableByteChannel readFile(String filename, long position, Session userSession) throws FailedActionException {
     try {
-      return Channels.newChannel(pathToFile(filename).io().inputStream());
+      return Channels.newChannel(pathToFile(filename).inputStream());
     } catch (TIoException e) {
       throw reportError(e);
     }
@@ -113,7 +113,7 @@ public class TestFtpServerFileSystem implements FileSystem {
 
   public WritableByteChannel saveFile(String filename, boolean append, Session userSession) throws FailedActionException {
     try {
-      return Channels.newChannel(pathToFile(filename).io().outputStream(append ? OutputMode.APPEND : OutputMode.OVERWRITE));
+      return Channels.newChannel(pathToFile(filename).outputStream(append ? OutputMode.APPEND : OutputMode.OVERWRITE));
     } catch (TIoException e) {
       throw reportError(e);
     }</diff>
      <filename>ftp/behaviour/src/net/sf/cotta/ftp/TestFtpServerFileSystem.java</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>core/behaviour/src/net/sf/cotta/io/InputManagerTest.java</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>aa28a10def663e0daf3ade1c44b9961aa2a5abab</id>
    </parent>
  </parents>
  <author>
    <name>wolfdancer</name>
    <email>wolfdancer@gmail.com</email>
  </author>
  <url>http://github.com/wolfdancer/cotta/commit/ae0e81a5bfa217855a17c9b09a502aa91f39c7fe</url>
  <id>ae0e81a5bfa217855a17c9b09a502aa91f39c7fe</id>
  <committed-date>2009-06-05T21:56:03-07:00</committed-date>
  <authored-date>2009-06-05T21:56:03-07:00</authored-date>
  <message>moved the static 'with' methods to Input/Output class and made the internal open method on ResourceManager non-public.  In this way, only the right methods will show up in the right context</message>
  <tree>b53f515c5d71f905888a23b116ca0e59edac1985</tree>
  <committer>
    <name>wolfdancer</name>
    <email>wolfdancer@gmail.com</email>
  </committer>
</commit>
